pulplift does not let you run unit tests with py.test
I think it's typical to go into an area of the tests (functional or unit) and run your test runner of choice, e.g.
py.test. So for example to run these tests I would:
1. activate the pulp3 virtualenv with pulplift using
2. cd to pulpcore/tests/unit
3. Run with
I get a whole bunch of errors saying
Model class pulpcore.app.models.content.Artifact doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Note that running the py.test on the functional tests works, so this is a unit test issue.
You can use
manage.py instead to workaround it. I'm hoping we can get py.test working again somehow also.
#4 Updated by CodeHeeler 8 months ago
So I did some digging on this and it seems this error may be related to our use of __init__.py files and the way unittest handles them:
There were several suggested solutions here:
I tried the one involving nose, which I've used in the past, rather than the code change options but still couldn't get rid of the errors.
I wanted to bounce this off folks before going further as we've had the __init__ files a while and I'm not sure how it is broken for you specifically in pulplift only if that's the problem. Does py.test work for you in our old devel way of running vagrant? For that matter, has py.test ever worked for you in our pulplift (want to eliminate the possibility that a recent change caused this)? Thanks!
I would say this is expected and not an issue. Django unit tests need a bunch of stuff built up, such as the DB connections, the settings file being parsed, a fresh throwaway test-only database, etc. and py.test doesn't know how to do all of that.
There's extensions that I think will do that, but I haven't really tried. But that's why we've just used the Django unit test runner "./manage.py test <app or directory>.
Since the smash tests are run with Pulp running normally in production, they're more independent in this respect, so you've always been able to just use py.test. But not so for unit tests.
- Status changed from NEW to CLOSED - NOTABUG
Actually I see docs here: https://docs.pulpproject.org/en/3.0/nightly/contributing/dev-setup/runtests.html#running-tests
They probably could use some touching up, but they aren't wrong or missing so I'm closing this as NOTABUG.
Please register to edit this issue