Zitrax / nose-dep

Nosetest plugin for test dependencies. Makes it possible to let tests depend on each other and/or run in a specific order.
MIT License
2 stars 3 forks source link

`nosetests --with-nosedep <module>` runs much more tests than asked for #14

Open ydirson opened 4 years ago

ydirson commented 4 years ago
yann@yantop:omaha (wip/tori-ai<>)$ nosetests3
.........................................................................................................................
----------------------------------------------------------------------
Ran 121 tests in 5.007s

OK
$ nosetests3 Omaha.test
.......................................................................
----------------------------------------------------------------------
Ran 71 tests in 4.849s

OK
$ nosetests3 Omaha.test.test_torishogi
...
----------------------------------------------------------------------
Ran 3 tests in 0.523s

OK
$ nosetests3 --with-nosedep Omaha.test.test_torishogi
...........................................................................
----------------------------------------------------------------------
Ran 75 tests in 4.894s

OK

For now the only use of nosedep is in Omaha/test/test_torishogi.py:

@depends(after=test_loadpgn)
def test_undoredo():

See below the diff between the last 2 runs when using -v. You'll notice that the nosedep run does not include all of the tests of its supermodule, but also that some of those tests are run several times, and that the order of execution differs from the standard nosetests order, even for tests which do not make use of nosedep.

$ diff -u /tmp/nodeps-omaha /tmp/deps-tori
--- /tmp/nodeps-omaha   2020-08-04 19:41:46.467510379 +0200
+++ /tmp/deps-tori      2020-08-04 19:40:54.255121993 +0200
@@ -1,21 +1,33 @@
 Omaha.test.test_checkers.test_checkers ... ok
 Omaha.test.test_chess.test_chess ... ok
 Omaha.test.test_chess.test_loadpgn ... ok
-Omaha.test.test_chess5.test.test_enpassant ... ok
-Omaha.test.test_chess5.test.test_enpassant_delayed ... ok
-Omaha.test.test_chess5.test.test_enpassant_nonboost ... ok
-Omaha.test.test_chess5.test.test_pawn_check ... ok
-Omaha.test.test_chess5.test.test_undo_promotion ... ok
 Omaha.test.test_glinski.test00_hexbent_notation_a1.test_backnforth ... ok
 Omaha.test.test_glinski.test00_hexbent_notation_a6.test_backnforth ... ok
-Omaha.test.test_glinski.test00_hexbent_notation_f1.test_backnforth ... ok
 Omaha.test.test_glinski.test00_hexbent_notation_f11.test_backnforth ... ok
+Omaha.test.test_glinski.test00_hexbent_notation_f1.test_backnforth ... ok
 Omaha.test.test_glinski.test00_hexbent_notation_l1.test_backnforth ... ok
 Omaha.test.test_glinski.test00_hexbent_notation_l6.test_backnforth ... ok
 Omaha.test.test_glinski.test10_glinski ... ok
 Omaha.test.test_go.test_go ... ok 
-Omaha.test.test_go.test_nonstandardgo ... ok
 Omaha.test.test_go.test_loadsgf ... ok
+Omaha.test.test_go.test_nonstandardgo ... ok
+Omaha.test.test_minishogi.test.test_minishogi ... ok
+Omaha.test.test_minishogi.test.test_undo ... ok
+Omaha.test.test_minishogi.test_handicap ... ok
+Omaha.test.test_shogi.test_loadpgn ... ok
+Omaha.test.test_shoshogi.test_prince ... ok
+Omaha.test.test_shoshogi.test_shoshogi ... ok
+Omaha.test.test_torishogi.test_play.test_torishogi ... ok
+Omaha.test.test_torishogi.test_loadpgn ... ok
+Omaha.test.test_torishogi.test_undoredo ... ok
+Omaha.test.test_minishogi.test.test_minishogi ... ok
+Omaha.test.test_minishogi.test.test_undo ... ok
+Omaha.test.test_glinski.test00_hexbent_notation_a1.test_backnforth ... ok
+Omaha.test.test_glinski.test00_hexbent_notation_a6.test_backnforth ... ok
+Omaha.test.test_glinski.test00_hexbent_notation_f1.test_backnforth ... ok
+Omaha.test.test_glinski.test00_hexbent_notation_f11.test_backnforth ... ok
+Omaha.test.test_glinski.test00_hexbent_notation_l1.test_backnforth ... ok
+Omaha.test.test_glinski.test00_hexbent_notation_l6.test_backnforth ... ok
 Omaha.test.test_import.test_Apps.test_QtLauncher ... ok
 Omaha.test.test_import.test_Apps.test_QtPlay ... ok
 Omaha.test.test_import.test_CheckersPlayerDrivers.test_ManualEntry ... ok
@@ -60,17 +72,9 @@
 Omaha.test.test_import.test_ShogiPlayerDrivers.test_Multiplexer ... ok
 Omaha.test.test_import.test_ShogiPlayerDrivers.test_Stdin ... ok
 Omaha.test.test_import.test_ShogiPlayerDrivers.test_XShogi ... ok
-Omaha.test.test_minishogi.test.test_minishogi ... ok
-Omaha.test.test_minishogi.test.test_undo ... ok
-Omaha.test.test_minishogi.test_handicap ... ok
-Omaha.test.test_shogi.test_loadpgn ... ok
-Omaha.test.test_shoshogi.test_shoshogi ... ok
-Omaha.test.test_shoshogi.test_prince ... ok
 Omaha.test.test_torishogi.test_play.test_torishogi ... ok
-Omaha.test.test_torishogi.test_loadpgn ... ok
-Omaha.test.test_torishogi.test_undoredo ... ok

 ----------------------------------------------------------------------
-Ran 71 tests in 4.914s
+Ran 75 tests in 4.940s
Zitrax commented 4 years ago

Hi, this does sound similar to #13 which links to a proposed fix. Maybe it would be possible for you to see if that helps?

Looks like that fix was never included in a release, so would be interesting to know if solves this as well.