Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discover should ignore build/ and dist/ by default #1544

mikofski opened this Issue Apr 29, 2016 · 0 comments


None yet
3 participants
Copy link

mikofski commented Apr 29, 2016

If running py.test from same folder as then test discovery may enter build/ causing errors. Removing the build/ directory, using --ignore=build and setting norecursedirs for [pytest] in any .ini file all solve the issue, but can py.test be configured to always ignore this folder? Note nose2 and nosetests do not have this issue.

In the case where dynamic module import occurs and the path is specified relative to the test directory, then py.test returns the following stacktrace:

___________ ERROR collecting build/lib/circus/tests/ ___________
c:\python27\lib\site-packages\py\_path\ in pyimport
build\lib\my_package\tests\ in <module>
    fid, fn, info = imp.find_module(MODULE, [PACKAGE])
E   ImportError: No module named dynamic_module

minimalist example

my_package -> tests ->

import os
import imp

MODULE = 'dynamic_module'
PACKAGE = os.path.join('path', 'to', 'package', 'of', 'dynamic_module']

# use imp to find and load dynamic module
fid, fn, info = imp.find_module(MODULE, [PACKAGE])
my_module = imp.load_module(MODULE, fid, fn, info)

OS and Python

  • Windows-7 (AMD64)
  • Python-2.7.10 (AMD64) from

py.test --version

This is pytest version 2.9.1, imported from c:\python27\lib\site-packages\pytest.pyc



Thanks for submitting an issue!

Here's a quick checklist in what to include:

  • Include a detailed description of the bug or suggestion
  • pip list of the virtual environment you are using
  • py.test and operating system versions
  • Minimal example if possible

@nicoddemus nicoddemus closed this May 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.