RDFLib / rdflib-sqlalchemy

RDFLib store using SQLAlchemy dbapi as back-end
Other
148 stars 34 forks source link

0.5.0: test suite is usimg `nose` #90

Closed kloczek closed 2 years ago

kloczek commented 2 years ago

nose module is now deprecated and cannot be used with puthon 3.x https://nose.readthedocs.io/en/latest/

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-rdflib-sqlalchemy-0.5.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-rdflib-sqlalchemy-0.5.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0
collected 6 items / 5 errors

================================================================================== ERRORS ==================================================================================
_________________________________________________________________ ERROR collecting test/test_sqlalchemy.py _________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0/test/test_sqlalchemy.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_sqlalchemy.py:19: in <module>
    from sqlalchemy.sql.selectable import Select
E   ModuleNotFoundError: No module named 'sqlalchemy'
______________________________________________________________ ERROR collecting test/test_sqlalchemy_mysql.py ______________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0/test/test_sqlalchemy_mysql.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_sqlalchemy_mysql.py:5: in <module>
    from nose import SkipTest
E   ModuleNotFoundError: No module named 'nose'
___________________________________________________________ ERROR collecting test/test_sqlalchemy_postgresql.py ____________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0/test/test_sqlalchemy_postgresql.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_sqlalchemy_postgresql.py:5: in <module>
    from nose import SkipTest
E   ModuleNotFoundError: No module named 'nose'
________________________________________________________ ERROR collecting test/test_sqlalchemy_postgresql_pg8000.py ________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0/test/test_sqlalchemy_postgresql_pg8000.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_sqlalchemy_postgresql_pg8000.py:6: in <module>
    from nose import SkipTest
E   ModuleNotFoundError: No module named 'nose'
_____________________________________________________________ ERROR collecting test/test_sqlalchemy_sqlite.py ______________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0/test/test_sqlalchemy_sqlite.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
test/test_sqlalchemy_sqlite.py:5: in <module>
    from nose import SkipTest
E   ModuleNotFoundError: No module named 'nose'
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/_pytest/fixtures.py:227
  /usr/lib/python3.8/site-packages/_pytest/fixtures.py:227: UserWarning: Code: _pytestfixturefunction is not defined in namespace SDO
    fixturemarker: Optional[FixtureFunctionMarker] = getattr(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
ERROR test/test_sqlalchemy.py
ERROR test/test_sqlalchemy_mysql.py
ERROR test/test_sqlalchemy_postgresql.py
ERROR test/test_sqlalchemy_postgresql_pg8000.py
ERROR test/test_sqlalchemy_sqlite.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================= 1 warning, 5 errors in 0.36s =======================================================================

On migration to pytest can be used https://github.com/schollii/nose2pytest/

kloczek commented 2 years ago

After add above files to --ignore list pytest shows warnings:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-rdflib-sqlalchemy-0.5.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-rdflib-sqlalchemy-0.5.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --ignore test/test_sqlalchemy_mysql.py --ignore test/test_sqlalchemy_postgresql_pg8000.py --ignore test/test_sqlalchemy_postgresql.py --ignore test/test_sqlalchemy.py --ignore test/test_sqlalchemy_sqlite.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0
collected 6 items

test/open_test.py .                                                                                                                                                  [ 16%]
test/test_aggregate_graphs.py ..                                                                                                                                     [ 50%]
test/test_store_performance.py ..                                                                                                                                    [ 83%]
test/test_type_to_term_combination.py .                                                                                                                              [100%]

============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/_pytest/fixtures.py:227
  /usr/lib/python3.8/site-packages/_pytest/fixtures.py:227: UserWarning: Code: _pytestfixturefunction is not defined in namespace SDO
    fixturemarker: Optional[FixtureFunctionMarker] = getattr(

test/test_store_performance.py: 36 warnings
  /home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0/rdflib_sqlalchemy/sql.py:65: SADeprecationWarning: Implicit coercion of SELECT and textual SELECT constructs into FROM clauses is deprecated; please call .subquery() on any Core select or ORM Query object in order to produce a subquery object.
    select_clause = expression.select([functions.count().label('aCount')]).select_from(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
===================================================================== 6 passed, 37 warnings in 14.89s ======================================================================
mwatts15 commented 2 years ago

thanks. i had at least started switching to pytest, I think. will try to switch over properly soon

On Fri, Apr 8, 2022, 11:07 Tomasz Kłoczko @.***> wrote:

After add above files to --ignore list pytest shows warnings:

  • PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-rdflib-sqlalchemy-0.5.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-rdflib-sqlalchemy-0.5.0-2.fc35.x86_64/usr/lib/python3.8/site-packages+ /usr/bin/pytest -ra --ignore test/test_sqlalchemy_mysql.py --ignore test/test_sqlalchemy_postgresql_pg8000.py --ignore test/test_sqlalchemy_postgresql.py --ignore test/test_sqlalchemy.py --ignore test/test_sqlalchemy_sqlite.py=========================================================================== test session starts ============================================================================platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0rootdir: /home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0collected 6 items test/open_test.py . [ 16%]test/test_aggregate_graphs.py .. [ 50%]test/test_store_performance.py .. [ 83%]test/test_type_to_term_combination.py . [100%] ============================================================================= warnings summary =============================================================================../../../../../usr/lib/python3.8/site-packages/_pytest/fixtures.py:227 /usr/lib/python3.8/site-packages/_pytest/fixtures.py:227: UserWarning: Code: _pytestfixturefunction is not defined in namespace SDO fixturemarker: Optional[FixtureFunctionMarker] = getattr( test/test_store_performance.py: 36 warnings /home/tkloczko/rpmbuild/BUILD/rdflib-sqlalchemy-0.5.0/rdflib_sqlalchemy/sql.py:65: SADeprecationWarning: Implicit coercion of SELECT and textual SELECT constructs into FROM clauses is deprecated; please call .subquery() on any Core select or ORM Query object in order to produce a subquery object. select_clause = expression.select([functions.count().label('aCount')]).select_from( -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html===================================================================== 6 passed, 37 warnings in 14.89s ======================================================================

— Reply to this email directly, view it on GitHub https://github.com/RDFLib/rdflib-sqlalchemy/issues/90#issuecomment-1093046155, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALLFSCH33G6FOHTKYKGKA3VEBKTXANCNFSM5S47XHUA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mwatts15 commented 2 years ago

So, we had already switched over on the develop branch. If you need a release version that uses pytest, please use the just-released 0.5.1.

kloczek commented 2 years ago

Thank you 😄