Skip to content

Commit

Permalink
Merge pull request #1840 from dib-lab/fix/stdout-err_to_pytest_capsys
Browse files Browse the repository at this point in the history
Closes #1839.
  • Loading branch information
standage committed Feb 13, 2018
2 parents 8a9c382 + 8f28faf commit a6e1189
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions tests/test_sandbox_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _sandbox_scripts():


@pytest.mark.parametrize("filename", _sandbox_scripts())
def test_import_succeeds(filename, tmpdir):
def test_import_succeeds(filename, tmpdir, capsys):
try:
mod = imp.load_source('__zzz', filename)
except:
Expand All @@ -86,10 +86,6 @@ def test_import_succeeds(filename, tmpdir):
oldargs = sys.argv
sys.argv = [filename]

oldout, olderr = sys.stdout, sys.stderr
sys.stdout = StringIO()
sys.stderr = StringIO()

try:
try:
global_dict = {'__name__': '__main__'}
Expand All @@ -104,8 +100,6 @@ def test_import_succeeds(filename, tmpdir):
pass # other failures are expected :)
finally:
sys.argv = oldargs
out, err = sys.stdout.getvalue(), sys.stderr.getvalue()
sys.stdout, sys.stderr = oldout, olderr


@pytest.mark.skipif(not IN_REPOSITORY,
Expand Down

0 comments on commit a6e1189

Please sign in to comment.