1
1
from tests .lib import create_test_package_with_setup
2
2
3
3
4
- def matches_expected_lines (string , expected_lines , exact = True ):
5
- if exact :
6
- return set (string .splitlines ()) == set (expected_lines )
7
- # If not exact, check that all expected lines are present
4
+ def contains_expected_lines (string , expected_lines ):
8
5
return set (expected_lines ) <= set (string .splitlines ())
9
6
10
7
11
- def test_check_install_canonicalization (script , deprecated_python ):
8
+ def test_check_install_canonicalization (script ):
12
9
pkga_path = create_test_package_with_setup (
13
10
script ,
14
11
name = 'pkgA' ,
@@ -38,11 +35,10 @@ def test_check_install_canonicalization(script, deprecated_python):
38
35
allow_stderr_error = True ,
39
36
)
40
37
expected_lines = [
41
- "ERROR: pkga 1.0 requires SPECIAL.missing, which is not installed." ,
38
+ "pkga 1.0 requires SPECIAL.missing, which is not installed." ,
42
39
]
43
40
# Deprecated python versions produce an extra warning on stderr
44
- assert matches_expected_lines (
45
- result .stderr , expected_lines , exact = not deprecated_python )
41
+ assert contains_expected_lines (result .stderr , expected_lines )
46
42
assert result .returncode == 0
47
43
48
44
# Install the second missing package and expect that there is no warning
@@ -51,21 +47,19 @@ def test_check_install_canonicalization(script, deprecated_python):
51
47
result = script .pip (
52
48
'install' , '--no-index' , special_path , '--quiet' ,
53
49
)
54
- assert matches_expected_lines (
55
- result .stderr , [], exact = not deprecated_python )
50
+ assert "requires" not in result .stderr
56
51
assert result .returncode == 0
57
52
58
53
# Double check that all errors are resolved in the end
59
54
result = script .pip ('check' )
60
55
expected_lines = [
61
56
"No broken requirements found." ,
62
57
]
63
- assert matches_expected_lines (result .stdout , expected_lines )
58
+ assert contains_expected_lines (result .stdout , expected_lines )
64
59
assert result .returncode == 0
65
60
66
61
67
- def test_check_install_does_not_warn_for_out_of_graph_issues (
68
- script , deprecated_python ):
62
+ def test_check_install_does_not_warn_for_out_of_graph_issues (script ):
69
63
pkg_broken_path = create_test_package_with_setup (
70
64
script ,
71
65
name = 'broken' ,
@@ -85,33 +79,30 @@ def test_check_install_does_not_warn_for_out_of_graph_issues(
85
79
86
80
# Install a package without it's dependencies
87
81
result = script .pip ('install' , '--no-index' , pkg_broken_path , '--no-deps' )
88
- # Deprecated python versions produce an extra warning on stderr
89
- assert matches_expected_lines (
90
- result .stderr , [], exact = not deprecated_python )
82
+ assert "requires" not in result .stderr
91
83
92
84
# Install conflict package
93
85
result = script .pip (
94
86
'install' , '--no-index' , pkg_conflict_path , allow_stderr_error = True ,
95
87
)
96
- assert matches_expected_lines (result .stderr , [
97
- "ERROR: broken 1.0 requires missing, which is not installed." ,
88
+ assert contains_expected_lines (result .stderr , [
89
+ "broken 1.0 requires missing, which is not installed." ,
98
90
(
99
- "ERROR: broken 1.0 has requirement conflict<1.0, but "
91
+ "broken 1.0 requires conflict<1.0, but "
100
92
"you'll have conflict 1.0 which is incompatible."
101
93
),
102
- ], exact = not deprecated_python )
94
+ ])
103
95
104
96
# Install unrelated package
105
97
result = script .pip (
106
98
'install' , '--no-index' , pkg_unrelated_path , '--quiet' ,
107
99
)
108
100
# should not warn about broken's deps when installing unrelated package
109
- assert matches_expected_lines (
110
- result .stderr , [], exact = not deprecated_python )
101
+ assert "requires" not in result .stderr
111
102
112
103
result = script .pip ('check' , expect_error = True )
113
104
expected_lines = [
114
105
"broken 1.0 requires missing, which is not installed." ,
115
106
"broken 1.0 has requirement conflict<1.0, but you have conflict 1.0." ,
116
107
]
117
- assert matches_expected_lines (result .stdout , expected_lines )
108
+ assert contains_expected_lines (result .stdout , expected_lines )
0 commit comments