Page MenuHomeSoftware Heritage

tox.ini: Fix py3 environment to use packaged tests
ClosedPublic

Authored by ardumont on Wed, Oct 9, 3:55 PM.

Diff Detail

Repository
rDCIDX Metadata indexer
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont created this revision.Wed, Oct 9, 3:55 PM

Build has FAILED

It's not a test failure per say. Somehow, the wsgi module loads the app.
Which fails on the check since SWH_CONFIG_FILENAME is not set.

==================================== ERRORS ====================================
_ ERROR collecting .tox/py3/lib/python3.5/site-packages/swh/indexer/storage/api/wsgi.py _
.tox/py3/lib/python3.5/site-packages/swh/indexer/storage/api/wsgi.py:8: in <module>
    application = make_app_from_configfile()
.tox/py3/lib/python3.5/site-packages/swh/indexer/storage/api/server.py:98: in make_app_from_configfile
    api_cfg = load_and_check_config(config_file)
.tox/py3/lib/python3.5/site-packages/swh/indexer/storage/api/server.py:61: in load_and_check_config
    raise EnvironmentError('Configuration file must be defined')
E   OSError: Configuration file must be defined

I don't get it.

I don't get it.

I mean i don't get why now it tries and load the wsgi module...
I'll check in a bit.

I mean i don't get why now it tries and load the wsgi module...

It's normal for pytest to import all modules; and this module initializes the app every time it's imported.

What I don't understand is why pytest didn't import it before this diff.

It's normal for pytest to import all modules; and this module initializes the app every time it's imported.
What I don't understand is why pytest didn't import it before this diff.

It so happens that a similar behavior is at least in objstorage and storage...
And it poses no issue whatsoever.

ardumont added a comment.EditedWed, Oct 9, 6:32 PM

It's normal for pytest to import all modules; and this module initializes the app every time it's imported.
What I don't understand is why pytest didn't import it before this diff.

It so happens that a similar behavior is at least in objstorage and storage...
And it poses no issue whatsoever.

In objstorage's tox.ini, there is no pifpaf (as in swh-indexer). So comparing with storage solely as it's quite similar.
In storage, there is no --doctest-modules...

Removing that flag, tox is ok locally.
I'll amend the diff to demonstrate this... (and check ci is indeed ok without it)

ardumont updated this revision to Diff 7062.Wed, Oct 9, 6:33 PM
  • tox.ini: Remove --doctest-modules as a demo it works ok without it
ardumont updated this revision to Diff 7063.EditedWed, Oct 9, 11:07 PM
  • Remove indirection swh.indexer.storage.api.wsgi to start server

Related f147893 (<- staging)
Related D2109 (<- to merge in production)

ardumont edited the summary of this revision. (Show Details)Wed, Oct 9, 11:10 PM
vlorentz accepted this revision.Thu, Oct 10, 10:43 AM
This revision is now accepted and ready to land.Thu, Oct 10, 10:43 AM