Skip to content

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

@dhruvmanila

Description

@dhruvmanila

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions