Issue #4481

pulplift does not let you run unit tests with py.test

Added by bmbouter almost 2 years ago. Updated over 1 year ago.

Start date:
Due date:
Estimated time:
2. Medium
Platform Release:
Sprint Candidate:
Dev Environment


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 workon pulp
2. cd to pulpcore/tests/unit
3. Run with py.test

I get a whole bunch of errors saying Model class 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 instead to workaround it. I'm hoping we can get py.test working again somehow also.


#1 Updated by bmbouter almost 2 years ago

  • Tags Dev Environment added
  • Tags deleted (Pulp 3 installer)

#2 Updated by bmbouter almost 2 years ago

  • Description updated (diff)

#3 Updated by bmbouter almost 2 years ago

  • Subject changed from pulplift does not let you run tests with py.test to pulplift does not let you run unit tests with py.test
  • Description updated (diff)

#4 Updated by CodeHeeler almost 2 years ago

So I did some digging on this and it seems this error may be related to our use of 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!

#5 Updated by dalley almost 2 years ago

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 "./ 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.

#6 Updated by bmbouter almost 2 years ago

dalley, thank you for explaining this to me. This makes perfect sense. Do you happen to know if we have this documented anywhere? If not I can rewrite this to be a docs story. If so, then we can close NOTABUG. Thanks!

#7 Updated by bmbouter almost 2 years ago

  • Status changed from NEW to CLOSED - NOTABUG

Actually I see docs here:

They probably could use some touching up, but they aren't wrong or missing so I'm closing this as NOTABUG.

#8 Updated by daviddavis almost 2 years ago

  • Sprint/Milestone set to 3.0.0

#9 Updated by bmbouter over 1 year ago

  • Tags deleted (Pulp 3)

Please register to edit this issue

Also available in: Atom PDF