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

setup.py test says it runs tests, but it doesn't #446

Closed
ghost opened this issue Oct 9, 2015 · 5 comments
Closed

setup.py test says it runs tests, but it doesn't #446

ghost opened this issue Oct 9, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Oct 9, 2015

Originally reported by: thomas-guettler (Bitbucket: thomas-guettler, GitHub: Unknown)


the pypa sampleproject contains a test, but if you run setup.py test it does not get executed.

I opened an issue for the sampleproject, but I was told that this is an issue of setuptools.

See:

pypa/sampleproject#33

At the moment the string "running test" gets printed although no test was found. That is very confusing since no test was found.

What should happen if you run setup.py test and setuptools doesn't find any test?


@ghost
Copy link
Author

ghost commented Oct 10, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


The default behavior of setup.py test is to invoke the test_suite indicated by the command or in defined in the distribution. Since sampleproject doesn't define a test_suite, the test command isn't expected to do anything. When setuptools was given, unittest didn't have any discovery protocol, so it didn't make sense for the test command to do anything if no test_suite was supplied.

At this point, it may make sense for setuptools to run unittest with its default autodiscovery protocol if no overrides are supplied.

@ghost
Copy link
Author

ghost commented Oct 11, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Always execute tests, even if no test_suite is supplied. Fixes #446.

@ghost
Copy link
Author

ghost commented Oct 11, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Only include test_suite in args if one is specified. Ref #446.

@ghost
Copy link
Author

ghost commented Oct 11, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


The output I get now is

$ python setup.py test
running test
Searching for peppercorn
Best match: peppercorn 0.5
Processing peppercorn-0.5-py3.5.egg

Using /Users/jaraco/Dropbox/code/public/sampleproject/.eggs/peppercorn-0.5-py3.5.egg
running egg_info
writing sample.egg-info/PKG-INFO
writing requirements to sample.egg-info/requires.txt
writing top-level names to sample.egg-info/top_level.txt
writing dependency_links to sample.egg-info/dependency_links.txt
writing entry points to sample.egg-info/entry_points.txt
reading manifest file 'sample.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sample.egg-info/SOURCES.txt'
running build_ext
test_failure (tests.test_simple.TestSimple) ... FAIL
test_failure (tests.test_simple.TestSimple) ... FAIL

======================================================================
FAIL: test_failure (tests.test_simple.TestSimple)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/sampleproject/tests/test_simple.py", line 9, in test_failure
    self.assertTrue(False)
AssertionError: False is not true

======================================================================
FAIL: test_failure (tests.test_simple.TestSimple)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jaraco/Dropbox/code/public/sampleproject/tests/test_simple.py", line 9, in test_failure
    self.assertTrue(False)
AssertionError: False is not true

----------------------------------------------------------------------
Ran 2 tests in 0.001s

FAILED (failures=2)

Is that the expected output?

@ghost
Copy link
Author

ghost commented Oct 19, 2015

Original comment by thomas-guettler (Bitbucket: thomas-guettler, GitHub: Unknown):


The test gets executed. Nice, I am happy, thank you.

But why does it get executed twice?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants