1
1
# -*- coding: utf-8 -*-
2
2
3
- def test_first_mark (item_names_for ):
3
+
4
+ def test_first (item_names_for ):
4
5
tests_content = """
5
6
import pytest
6
7
@@ -9,24 +10,69 @@ def test_1(): pass
9
10
@pytest.mark.first
10
11
def test_2(): pass
11
12
"""
12
-
13
13
assert item_names_for (tests_content ) == ['test_2' , 'test_1' ]
14
14
15
15
16
- def test_last_mark (item_names_for ):
16
+ def test_second (item_names_for ):
17
+ tests_content = """
18
+ import pytest
19
+
20
+ def test_1(): pass
21
+ def test_2(): pass
22
+ def test_3(): pass
23
+ def test_4(): pass
24
+
25
+ @pytest.mark.second
26
+ def test_5(): pass
27
+ """
28
+ assert item_names_for (tests_content ) == ['test_1' , 'test_5' , 'test_2' , 'test_3' , 'test_4' ]
29
+
30
+
31
+ def test_third (item_names_for ):
32
+ tests_content = """
33
+ import pytest
34
+
35
+ def test_1(): pass
36
+ def test_2(): pass
37
+ def test_3(): pass
38
+
39
+ @pytest.mark.third
40
+ def test_4(): pass
41
+
42
+ def test_5(): pass
43
+ """
44
+ assert item_names_for (tests_content ) == ['test_1' , 'test_2' , 'test_4' , 'test_3' , 'test_5' ]
45
+
46
+
47
+ def test_second_to_last (item_names_for ):
17
48
tests_content = """
18
49
import pytest
19
50
20
- @pytest.mark.last
21
51
def test_1(): pass
22
52
53
+ @pytest.mark.second_to_last
23
54
def test_2(): pass
55
+
56
+ def test_3(): pass
57
+ def test_4(): pass
58
+ def test_5(): pass
24
59
"""
60
+ assert item_names_for (tests_content ) == ['test_1' , 'test_3' , 'test_4' , 'test_2' , 'test_5' ]
61
+
25
62
63
+ def test_last (item_names_for ):
64
+ tests_content = """
65
+ import pytest
66
+
67
+ @pytest.mark.last
68
+ def test_1(): pass
69
+
70
+ def test_2(): pass
71
+ """
26
72
assert item_names_for (tests_content ) == ['test_2' , 'test_1' ]
27
73
28
74
29
- def test_first_last_marks (item_names_for ):
75
+ def test_first_last (item_names_for ):
30
76
tests_content = """
31
77
import pytest
32
78
@@ -38,5 +84,4 @@ def test_2(): pass
38
84
39
85
def test_3(): pass
40
86
"""
41
-
42
87
assert item_names_for (tests_content ) == ['test_2' , 'test_3' , 'test_1' ]
0 commit comments