Page MenuHomeSoftware Heritage

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

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

Diff Detail

Repository
rDCIDX Metadata indexer
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8255
Build 11923: tox-on-jenkinsJenkins
Build 11922: arc lint + arc unit

Event Timeline

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.

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)

  • tox.ini: Remove --doctest-modules as a demo it works ok without it
  • Remove indirection swh.indexer.storage.api.wsgi to start server

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

This revision is now accepted and ready to land.Oct 10 2019, 10:43 AM