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

Closed
mikofski opened this Issue Apr 29, 2016 · 0 comments

Comments

Projects
None yet
3 participants
@mikofski
Copy link

mikofski commented Apr 29, 2016

If running py.test from same folder as setup.py 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/test_outputs.py ___________
c:\python27\lib\site-packages\py\_path\local.py:650: in pyimport
    __import__(modname)
build\lib\my_package\tests\test_this.py:8: in <module>
    fid, fn, info = imp.find_module(MODULE, [PACKAGE])
E   ImportError: No module named dynamic_module

minimalist example

my_package -> tests -> test_this.py

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)
fid.close()

OS and Python

  • Windows-7 (AMD64)
  • Python-2.7.10 (AMD64) from python.org

py.test --version

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

requirements.txt

pint>=0.7.2
numpy>=1.8.2
xlrd>=0.9.4
nose
sphinx
scipy
python-dateutil
numexpr
pvlib==0.2.2

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.