File tree 3 files changed +45
-10
lines changed
3 files changed +45
-10
lines changed Original file line number Diff line number Diff line change 4
4
- preserve warning functions after call to pytest.deprecated_call. Thanks
5
5
Pieter Mulder for PR.
6
6
7
+ - fix issue833: --fixtures now shows all fixtures of collected test files, instead of just the
8
+ fixtures declared on the first one.
9
+ Thanks Florian Bruhin for reporting and Bruno Oliveira for the PR.
10
+
11
+
7
12
2.7.2 (compared to 2.7.1)
8
13
-----------------------------
9
14
27
32
Thanks Thomas De Schampheleire for reporting and Bruno Oliveira for the PR.
28
33
29
34
- fix issue718: failed to create representation of sets containing unsortable
30
- elements in python 2. Thanks Edison Gustavo Muenz
35
+ elements in python 2. Thanks Edison Gustavo Muenz.
31
36
32
37
- fix issue756, fix issue752 (and similar issues): depend on py-1.4.29
33
38
which has a refined algorithm for traceback generation.
Original file line number Diff line number Diff line change @@ -939,21 +939,13 @@ def showfixtures(config):
939
939
def _showfixtures_main (config , session ):
940
940
session .perform_collect ()
941
941
curdir = py .path .local ()
942
- if session .items :
943
- nodeid = session .items [0 ].nodeid
944
- else :
945
- part = session ._initialparts [0 ]
946
- nodeid = "::" .join (map (str , [curdir .bestrelpath (part [0 ])] + part [1 :]))
947
- nodeid .replace (session .fspath .sep , "/" )
948
-
949
942
tw = py .io .TerminalWriter ()
950
943
verbose = config .getvalue ("verbose" )
951
944
952
945
fm = session ._fixturemanager
953
946
954
947
available = []
955
- for argname in fm ._arg2fixturedefs :
956
- fixturedefs = fm .getfixturedefs (argname , nodeid )
948
+ for argname , fixturedefs in fm ._arg2fixturedefs .items ():
957
949
assert fixturedefs is not None
958
950
if not fixturedefs :
959
951
continue
Original file line number Diff line number Diff line change @@ -2483,6 +2483,44 @@ def arg2():
2483
2483
""" )
2484
2484
2485
2485
2486
+ def test_show_fixtures_different_files (self , testdir ):
2487
+ """
2488
+ #833: --fixtures only shows fixtures from first file
2489
+ """
2490
+ testdir .makepyfile (test_a = '''
2491
+ import pytest
2492
+
2493
+ @pytest.fixture
2494
+ def fix_a():
2495
+ """Fixture A"""
2496
+ pass
2497
+
2498
+ def test_a(fix_a):
2499
+ pass
2500
+ ''' )
2501
+ testdir .makepyfile (test_b = '''
2502
+ import pytest
2503
+
2504
+ @pytest.fixture
2505
+ def fix_b():
2506
+ """Fixture B"""
2507
+ pass
2508
+
2509
+ def test_b(fix_b):
2510
+ pass
2511
+ ''' )
2512
+ result = testdir .runpytest ("--fixtures" )
2513
+ result .stdout .fnmatch_lines ("""
2514
+ * fixtures defined from test_a *
2515
+ fix_a
2516
+ Fixture A
2517
+
2518
+ * fixtures defined from test_b *
2519
+ fix_b
2520
+ Fixture B
2521
+ """ )
2522
+
2523
+
2486
2524
class TestContextManagerFixtureFuncs :
2487
2525
def test_simple (self , testdir ):
2488
2526
testdir .makepyfile ("""
You can’t perform that action at this time.
0 commit comments