Skip to content

Commit 76a8954

Browse files
authored
Merge pull request #6856 from chrahunt/maint/remove-unneeded-expect-error-stderr
Remove unnecessary expect_error
2 parents 908e203 + 73e33ae commit 76a8954

16 files changed

+106
-92
lines changed

tests/functional/test_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def test_check_complicated_name_clean(script):
166166
)
167167
assert "Successfully installed dependency-b-1.0" in result.stdout
168168

169-
result = script.pip('check', expect_error=True)
169+
result = script.pip('check')
170170
expected_lines = (
171171
"No broken requirements found.",
172172
)

tests/functional/test_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_completion_alone(script):
6565
"""
6666
Test getting completion for none shell, just pip completion
6767
"""
68-
result = script.pip('completion', expect_error=True)
68+
result = script.pip('completion', allow_stderr_error=True)
6969
assert 'ERROR: You must pass --bash or --fish or --zsh' in result.stderr, \
7070
'completion alone failed -- ' + result.stderr
7171

tests/functional/test_download.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_download_if_requested(script):
2121
It should download (in the scratch path) and not install if requested.
2222
"""
2323
result = script.pip(
24-
'download', '-d', 'pip_downloads', 'INITools==0.1', expect_error=True
24+
'download', '-d', 'pip_downloads', 'INITools==0.1'
2525
)
2626
assert Path('scratch') / 'pip_downloads' / 'INITools-0.1.tar.gz' \
2727
in result.files_created
@@ -68,7 +68,6 @@ def test_single_download_from_requirements_file(script):
6868
"""))
6969
result = script.pip(
7070
'download', '-r', script.scratch_path / 'test-req.txt', '-d', '.',
71-
expect_error=True,
7271
)
7372
assert Path('scratch') / 'INITools-0.1.tar.gz' in result.files_created
7473
assert script.site_packages / 'initools' not in result.files_created
@@ -80,7 +79,7 @@ def test_basic_download_should_download_dependencies(script):
8079
It should download dependencies (in the scratch path)
8180
"""
8281
result = script.pip(
83-
'download', 'Paste[openid]==1.7.5.1', '-d', '.', expect_error=True,
82+
'download', 'Paste[openid]==1.7.5.1', '-d', '.'
8483
)
8584
assert Path('scratch') / 'Paste-1.7.5.1.tar.gz' in result.files_created
8685
openid_tarball_prefix = str(Path('scratch') / 'python-openid-')
@@ -129,7 +128,6 @@ def test_download_should_skip_existing_files(script):
129128

130129
result = script.pip(
131130
'download', '-r', script.scratch_path / 'test-req.txt', '-d', '.',
132-
expect_error=True,
133131
)
134132
assert Path('scratch') / 'INITools-0.1.tar.gz' in result.files_created
135133
assert script.site_packages / 'initools' not in result.files_created
@@ -143,7 +141,6 @@ def test_download_should_skip_existing_files(script):
143141
# only the second package should be downloaded
144142
result = script.pip(
145143
'download', '-r', script.scratch_path / 'test-req.txt', '-d', '.',
146-
expect_error=True,
147144
)
148145
openid_tarball_prefix = str(Path('scratch') / 'python-openid-')
149146
assert any(
@@ -387,7 +384,6 @@ def test_explicit_platform_only(self, data, script):
387384
'--dest', '.',
388385
'--platform', 'linux_x86_64',
389386
'fake',
390-
expect_error=True,
391387
)
392388

393389

@@ -571,7 +567,6 @@ def test_download_specify_abi(script, data):
571567
'--dest', '.',
572568
'--abi', 'cp27m',
573569
'fake',
574-
expect_error=True,
575570
)
576571

577572
data.reset()

tests/functional/test_install.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def _test_install_editable_from_git(script, tmpdir):
262262
"""Test cloning from Git."""
263263
pkg_path = _create_test_package(script, name='testpackage', vcs='git')
264264
args = ['install', '-e', 'git+%s#egg=testpackage' % path_to_url(pkg_path)]
265-
result = script.pip(*args, **{"expect_error": True})
265+
result = script.pip(*args)
266266
result.assert_installed('testpackage', with_files=['.git'])
267267

268268

@@ -331,7 +331,7 @@ def test_basic_install_editable_from_hg(script, tmpdir):
331331
"""Test cloning from Mercurial."""
332332
pkg_path = _create_test_package(script, name='testpackage', vcs='hg')
333333
args = ['install', '-e', 'hg+%s#egg=testpackage' % path_to_url(pkg_path)]
334-
result = script.pip(*args, **{"expect_error": True})
334+
result = script.pip(*args)
335335
result.assert_installed('testpackage', with_files=['.hg'])
336336

337337

@@ -342,7 +342,7 @@ def test_vcs_url_final_slash_normalization(script, tmpdir):
342342
"""
343343
pkg_path = _create_test_package(script, name='testpackage', vcs='hg')
344344
args = ['install', '-e', 'hg+%s/#egg=testpackage' % path_to_url(pkg_path)]
345-
result = script.pip(*args, **{"expect_error": True})
345+
result = script.pip(*args)
346346
result.assert_installed('testpackage', with_files=['.hg'])
347347

348348

@@ -351,7 +351,7 @@ def test_install_editable_from_bazaar(script, tmpdir):
351351
"""Test checking out from Bazaar."""
352352
pkg_path = _create_test_package(script, name='testpackage', vcs='bazaar')
353353
args = ['install', '-e', 'bzr+%s/#egg=testpackage' % path_to_url(pkg_path)]
354-
result = script.pip(*args, **{"expect_error": True})
354+
result = script.pip(*args)
355355
result.assert_installed('testpackage', with_files=['.bzr'])
356356

357357

@@ -1264,8 +1264,8 @@ def test_install_editable_with_wrong_egg_name(script):
12641264
version='0.1')
12651265
"""))
12661266
result = script.pip(
1267-
'install', '--editable', 'file://%s#egg=pkgb' % pkga_path,
1268-
expect_error=True)
1267+
'install', '--editable', 'file://%s#egg=pkgb' % pkga_path
1268+
)
12691269
assert ("Generating metadata for package pkgb produced metadata "
12701270
"for project name pkga. Fix your #egg=pkgb "
12711271
"fragments.") in result.stderr
@@ -1368,7 +1368,7 @@ def test_install_compatible_python_requires(script):
13681368
python_requires='>1.0',
13691369
version='0.1')
13701370
"""))
1371-
res = script.pip('install', pkga_path, expect_error=True)
1371+
res = script.pip('install', pkga_path)
13721372
assert "Successfully installed pkga-0.1" in res.stdout, res
13731373

13741374

@@ -1424,7 +1424,7 @@ def test_install_from_test_pypi_with_ext_url_dep_is_blocked(script, index):
14241424

14251425
def test_installing_scripts_outside_path_prints_warning(script):
14261426
result = script.pip_install_local(
1427-
"--prefix", script.scratch_path, "script_wheel1", expect_error=True
1427+
"--prefix", script.scratch_path, "script_wheel1"
14281428
)
14291429
assert "Successfully installed script-wheel1" in result.stdout, str(result)
14301430
assert "--no-warn-script-location" in result.stderr

tests/functional/test_install_check.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ def test_check_install_canonicalization(script, deprecated_python):
3131
# Install the first missing dependency. Only an error for the
3232
# second dependency should remain.
3333
result = script.pip(
34-
'install', '--no-index', normal_path, '--quiet', expect_error=True
34+
'install',
35+
'--no-index',
36+
normal_path,
37+
'--quiet',
38+
allow_stderr_error=True,
3539
)
3640
expected_lines = [
3741
"ERROR: pkga 1.0 requires SPECIAL.missing, which is not installed.",
@@ -87,7 +91,7 @@ def test_check_install_does_not_warn_for_out_of_graph_issues(
8791

8892
# Install conflict package
8993
result = script.pip(
90-
'install', '--no-index', pkg_conflict_path, expect_error=True,
94+
'install', '--no-index', pkg_conflict_path, allow_stderr_error=True,
9195
)
9296
assert matches_expected_lines(result.stderr, [
9397
"ERROR: broken 1.0 requires missing, which is not installed.",

tests/functional/test_install_cleanup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def test_cleanup_after_install_editable_from_hg(script, tmpdir):
5151
'hg+https://bitbucket.org/ianb/scripttest',
5252
tmpdir.joinpath("cache"),
5353
),
54-
expect_error=True,
5554
)
5655
build = script.venv_path / 'build'
5756
src = script.venv_path / 'src'

tests/functional/test_install_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_debian_egg_name_workaround(script):
2121
https://bitbucket.org/ianb/pip/issue/104/pip-uninstall-on-ubuntu-linux
2222
2323
"""
24-
result = script.pip('install', 'INITools==0.2', expect_error=True)
24+
result = script.pip('install', 'INITools==0.2')
2525

2626
egg_info = os.path.join(
2727
script.site_packages, "INITools-0.2-py%s.egg-info" % pyversion)

tests/functional/test_install_config.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _test_env_vars_override_config_file(script, virtualenv, config_file):
7474
)
7575
script.environ['PIP_NO_INDEX'] = '0'
7676
virtualenv.clear()
77-
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
77+
result = script.pip('install', '-vvv', 'INITools')
7878
assert "Successfully installed INITools" in result.stdout
7979

8080

@@ -89,7 +89,6 @@ def test_command_line_append_flags(script, virtualenv, data):
8989
result = script.pip(
9090
'install', '-vvv', 'INITools', '--trusted-host',
9191
'test.pypi.org',
92-
expect_error=True,
9392
)
9493
assert (
9594
"Analyzing links from page https://test.pypi.org"
@@ -99,7 +98,6 @@ def test_command_line_append_flags(script, virtualenv, data):
9998
result = script.pip(
10099
'install', '-vvv', '--find-links', data.find_links, 'INITools',
101100
'--trusted-host', 'test.pypi.org',
102-
expect_error=True,
103101
)
104102
assert (
105103
"Analyzing links from page https://test.pypi.org"
@@ -123,7 +121,6 @@ def test_command_line_appends_correctly(script, data):
123121
result = script.pip(
124122
'install', '-vvv', 'INITools', '--trusted-host',
125123
'test.pypi.org',
126-
expect_error=True,
127124
)
128125

129126
assert (
@@ -175,7 +172,6 @@ def _test_config_file_override_stack(script, virtualenv, config_file):
175172
result = script.pip(
176173
'install', '-vvv', '--index-url', 'https://pypi.org/simple/',
177174
'INITools',
178-
expect_error=True,
179175
)
180176
assert (
181177
"Getting page http://download.zope.org/ppix/INITools"

tests/functional/test_install_force_reinstall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def check_force_reinstall(script, specifier, expected):
2626
assert result2.files_updated, 'force-reinstall failed'
2727
check_installed_version(script, 'simplewheel', expected)
2828

29-
result3 = script.pip('uninstall', 'simplewheel', '-y', expect_error=True)
29+
result3 = script.pip('uninstall', 'simplewheel', '-y')
3030
assert_all_changes(result, result3, [script.venv / 'build', 'cache'])
3131

3232

tests/functional/test_install_reqs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ def test_install_options_local_to_package(script, data):
534534
'install',
535535
'--no-index', '-f', data.find_links,
536536
'-r', reqs_file,
537-
expect_error=True,
538537
)
539538

540539
simple = test_simple / 'lib' / 'python' / 'simple'

0 commit comments

Comments
 (0)