Skip to content

Commit

Permalink
Merge pull request #28 from datalad/doc
Browse files Browse the repository at this point in the history
ci(appveyor): run doctests too
  • Loading branch information
mih authored Jun 14, 2024
2 parents 57a5862 + 837ae4d commit 82c72aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions datasalad/runners/iter_subproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 82c72aa

Please sign in to comment.