Skip to content

Commit

Permalink
Remove 'nonstdlib' dependency from the tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
kalekundert committed May 29, 2020
1 parent 8e8c73d commit 2c8df97
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tests/test_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
DIR = Path(__file__).parent / 'verify'

def run_cli(args, out='Layout written'):
import sys, re, shlex, subprocess as proc
from nonstdlib import capture_output
from contextlib import contextmanager
import sys, re, shlex
from io import StringIO
from contextlib import contextmanager, redirect_stdout

@contextmanager
def spoof_argv(*args):
Expand All @@ -25,16 +25,17 @@ def spoof_argv(*args):
finally:
sys.argv = orig_argv

with capture_output() as capture:
stdout = StringIO()
with redirect_stdout(stdout):
with spoof_argv('wellmap', '-o', f'{DIR}/$.pdf', *shlex.split(str(args))):
wellmap.verify.main()

if out is None:
return
if isinstance(out, str):
out = [out]
for expected in out:
assert re.search(expected, capture.stdout)
if out is None:
return
if isinstance(out, str):
out = [out]
for expected in out:
assert re.search(expected, stdout.getvalue())


def test_no_wells():
Expand Down

0 comments on commit 2c8df97

Please sign in to comment.