Not able to importing fixtures from sqlalchemy from 1.3.16 version

65 views
Skip to first unread message

sairohith yerramilli

unread,
Dec 9, 2021, 9:42:29 AM12/9/21
to sqlalchemy
Hi 
I am facing an issue when importing fixtures from sqlalchemy in version 1.3.16 and above.
When i am trying to import fixtures from sqlalchemy 
i.e "from sqlachemy.testing import fixtures" it throwing me an attribute error says 'NoneType' object has no attribute 'fixture'

This change in behavior is observed from this commit : 7c4512cbeb1cf9e4e988e833589ddc6377b5e525

I am unable to import fixtures with those commit changes. 

So can you help me in  importing fixture in the upgraded  versions of SQLAlchemy.

I have attached a screenshot for your reference

Thank you.

Sai Rohith Yerramilli

import errror.PNG

Mike Bayer

unread,
Dec 9, 2021, 12:30:58 PM12/9/21
to noreply-spamdigest via sqlalchemy
these fixtures are only for use within a pytest test suite that is using SQLAlchemy's plugins.  is this for a third party dialect project?
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.


Attachments:
  • import errror.PNG

sairohith yerramilli

unread,
Dec 11, 2021, 3:49:15 AM12/11/21
to sqlalchemy
Hi 

from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy.sql.functions import ReturnTypeFromArgs
from sqlalchemy import select
from sqlalchemy.sql import column

class isnull(ReturnTypeFromArgs):
          name = 'isnull'

class TestFunction(fixtures.TestBase,AssertsCompiledSQL):

           __dialect__ = 'mssql+mxodbc'

def test_null_concat(self):
           self.assert_compile(select([isnull(column('spam'), '') +
                                                             isnull(column('spamspam'), '').label("bothcols"), ]),
                                                              "SELECT isnull(spam, :isnull_1) + "
                                                              "isnull(spamspam, :isnull_2) AS anon_1")

 This piece of code is working good in SQLAlchemy 1.3.15 version and below but failing in above versions. 
Getting issue when importing  "from sqlalchemy.testing import fixtures".  

Thank you.



Mike Bayer

unread,
Dec 11, 2021, 11:47:15 AM12/11/21
to noreply-spamdigest via sqlalchemy
not expected to work right now unless you run pytest and you have the appropriate project layout installed as documented at https://github.com/sqlalchemy/sqlalchemy/blob/main/README.dialects.rst

sairohith yerramilli

unread,
Dec 11, 2021, 12:36:45 PM12/11/21
to sqlalchemy

Hi, 
Thank you for response. 
I would like to inform you that , for testing that code I am using pytest only. What i am facing is, it is worked properly till Sqlalchemy version 1.3.15.  When I  upgraded the Sqlalchemy version to 1.3.17 ,mentioned piece of code is failing at import level itself.
 ''from sqlalchemy. testing import fixtures",unable to import fixtures into my file to test my code. 
So how can I import fixtures in latest versions of sqlalchemy for testing my code. 

Thank you. 
Sai Rohith Yerramilli

Mike Bayer

unread,
Dec 12, 2021, 11:33:02 AM12/12/21
to noreply-spamdigest via sqlalchemy


On Sat, Dec 11, 2021, at 12:36 PM, sairohith yerramilli wrote:

Hi, 
Thank you for response. 
I would like to inform you that , for testing that code I am using pytest only. What i am facing is, it is worked properly till Sqlalchemy version 1.3.15.  When I  upgraded the Sqlalchemy version to 1.3.17 ,mentioned piece of code is failing at import level itself.
 ''from sqlalchemy. testing import fixtures",unable to import fixtures into my file to test my code. 
So how can I import fixtures in latest versions of sqlalchemy for testing my code. 

if you are not using the directory layout mentioned, you cannot.  you will need to extract the source code from the methods you are interested in and port them to your own libraries (i.e. vendor them).  this is not code that was intended for the way you were using it in 1.3.17.




Reply all
Reply to author
Forward
0 new messages