diff --git a/.appveyor.yml b/.appveyor.yml index 1374f33..6dc7e06 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -225,7 +225,7 @@ for: export TMPDIR=/crippledfs fi - echo TMPDIR=$TMPDIR - - hatch test --cover + - hatch test --cover --doctest-modules after_test: - python -m coverage xml diff --git a/README.md b/README.md index a6c47ad..2a93ec5 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,7 @@ shell command, while reading its output back as a Python iterable. >>> with iter_subproc(['cat'], inputs=[b'one', b'two', b'three']) as proc: ... for chunk in proc: ... print(chunk) -b'one' -b'two' -b'three' +b'onetwothree' ``` ## Developing with datasalad diff --git a/datasalad/runners/iter_subproc.py b/datasalad/runners/iter_subproc.py index 9abb1af..981871b 100644 --- a/datasalad/runners/iter_subproc.py +++ b/datasalad/runners/iter_subproc.py @@ -74,9 +74,7 @@ def iter_subproc( >>> with iter_subproc(['cat'], inputs=[b'one', b'two', b'three']) as proc: ... for chunk in proc: ... print(chunk) - b'one' - b'two' - b'three' + b'onetwothree' Note, if an exception is raised in the context, this exception will bubble up to the main thread. That means no ``CommandError`` will @@ -90,13 +88,15 @@ def iter_subproc( ``CommandError`` is raised. The return code is read from the variable ``ls_stdout`` - >>> try: - ... with iter_subproc(['ls', '-@']) as ls_stdout: - ... while True: - ... next(ls_stdout) - ... except Exception as e: - ... print(repr(e), ls_stdout.returncode) - StopIteration() 2 + .. code-block:: python + + >> try: + .. with iter_subproc(['ls', '-@']) as ls_stdout: + .. while True: + .. next(ls_stdout) + .. except Exception as e: + .. print(repr(e), ls_stdout.returncode) + StopIteration() 2 Parameters