Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while collecting tests for pytest --doctest-modules . #175

Open
dhruvmanila opened this issue Apr 12, 2021 · 0 comments
Open

Error while collecting tests for pytest --doctest-modules . #175

dhruvmanila opened this issue Apr 12, 2021 · 0 comments

Comments

@dhruvmanila
Copy link

Continuing from #118

I was wondering why do we have two test modules: test and tests. Running pytest . seems to be working perfectly well as it will get all the files in both test and tests directory and also the subdirectories with the same name. I ran the tests locally with pytest . and all tests are running and passing.

The failing tests are occurring for the doctest. Its failing right at the collection part as its not finding some imports. The list of errors:

ERROR infogami/core/dbupgrade.py - ImportError: cannot import name 'tdb' from 'infogami' (/Users/dhruvmanilawala/projects/infogami/infogami/__init__.py)
ERROR infogami/infobase/bulkupload.py - ImportError: cannot import name 'TYPES' from 'infogami.infobase.infobase' (/Users/dhruvmanilawala/projects/infogami/infogami/infobase/infobase.py)
ERROR infogami/plugins/i18n/code.py - web.webapi.HTTPError: 500 Internal Server Error
ERROR infogami/plugins/links/db.py - ImportError: cannot import name 'tdb' from 'infogami' (/Users/dhruvmanilawala/projects/infogami/infogami/__init__.py)
ERROR infogami/plugins/pages/code.py - ImportError: cannot import name 'tdb' from 'infogami' (/Users/dhruvmanilawala/projects/infogami/infogami/__init__.py)
ERROR infogami/plugins/review/code.py - ImportError: cannot import name 'pickdb' from 'infogami.utils.delegate' (/Users/dhruvmanilawala/projects/infogami/infogami/utils/delegate.py)
ERROR infogami/plugins/review/db.py - ImportError: cannot import name 'pickdb' from 'infogami.utils.delegate' (/Users/dhruvmanilawala/projects/infogami/infogami/utils/delegate.py)
ERROR infogami/plugins/wikitemplates/code.py - web.webapi.HTTPError: 500 Internal Server Error
ERROR migration/migrate-0.4-0.5.py - ModuleNotFoundError: No module named 'migrate-0'
  • It seems that tdb module was removed in the commit 1a41e7d and also the module dbupgrade is not used anywhere in the codebase.
  • Also, the function pickdb got removed in this commit 1144b7b and the constant TYPES got removed in 010c3e2
  • migration module should probably be ignored while running pytest.
  • It seems that infogami/plugins/i18n/code.py and infogami/plugins/wikitemplates/code.py will be calling functions on the global scope to setup some things.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant