classification
Title: unittest execute tests twice in some conditions
Type: behavior Stage:
Components: Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: ale5000, ezio.melotti, louielu, michael.foord, rbcollins, terry.reedy
Priority: normal Keywords:

Created on 2017-07-08 03:03 by ale5000, last changed 2017-07-16 23:16 by ale5000.

Messages (5)
msg297927 - (view) Author: ale5000 (ale5000) Date: 2017-07-08 03:03
Unittest execute the tests twice in some conditions.

You can see the log here: https://travis-ci.org/ale5000-git/test/builds/251382617

based on this code: https://github.com/ale5000-git/test/tree/7a64f24a8bfea0579e30346ba993744272aa9c36

The code to load tests is this:
def custom_test_suite():
    import unittest
    return unittest.TestLoader().discover("tests", pattern="*_test.py")
msg298366 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-07-14 18:06
What invocation conditions?  If this only happens with Travis, then this may be a Travis issue.  If it only happens with Travis coverage runs, then it might be intentional, or a coverage issue.
msg298376 - (view) Author: ale5000 (ale5000) Date: 2017-07-14 22:07
I have setup a simpler one here: https://github.com/ale5000-git/test/tree/master/unittest-1

Just run manually "setup.py test" and you will se the bug.
msg298383 - (view) Author: Louie Lu (louielu) * Date: 2017-07-15 05:12
On my MacOS with python 3.5.2 get this result:


➜  unittest-1 git:(master) ✗ python3 setup.py test
running test
running egg_info
writing dependency_links to Test_1.egg-info/dependency_links.txt
writing top-level names to Test_1.egg-info/top_level.txt
writing Test_1.egg-info/PKG-INFO
reading manifest file 'Test_1.egg-info/SOURCES.txt'
writing manifest file 'Test_1.egg-info/SOURCES.txt'
running build_ext
running test
running egg_info
writing dependency_links to Test_1.egg-info/dependency_links.txt
writing top-level names to Test_1.egg-info/top_level.txt
writing Test_1.egg-info/PKG-INFO
reading manifest file 'Test_1.egg-info/SOURCES.txt'
writing manifest file 'Test_1.egg-info/SOURCES.txt'
running build_ext
test_fix_all (test_main.MainTestCase) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.000s


with Python 3.7.a0 got this result:

➜  unittest-1 git:(master) ✗ /Users/louielu/Python/cpython/python.exe -m unittest
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK



I think it will be more like a setting issue, not unittest problem.
msg298452 - (view) Author: ale5000 (ale5000) Date: 2017-07-16 23:16
@louielu: I have the problem under Windows, and on Travis CI under Linux.
History
Date User Action Args
2017-07-16 23:16:36ale5000setmessages: + msg298452
2017-07-15 05:12:07louielusetnosy: + louielu
messages: + msg298383
2017-07-14 22:07:10ale5000setmessages: + msg298376
2017-07-14 18:06:56terry.reedysetnosy: + ezio.melotti, terry.reedy, michael.foord, rbcollins
messages: + msg298366
2017-07-08 03:03:49ale5000create