Repository: mwouts/jupytext
Pull request #85 (2018-09-18 23:38:54)

Output to stdout shouldn't append extra newline
Fixes https://github.com/mwouts/jupytext/issues/84.

codecov[bot]: # [Codecov](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=h1) Report
> Merging [#85](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=desc) into [master](https://codecov.io/gh/mwouts/jupytext/commit/960a962695fa061ed9d6ed103d55c3fbdecb23c1?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/mwouts/jupytext/pull/85/graphs/tree.svg?width=650&token=a1pNjsiILi&height=150&src=pr)](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master      #85      +/-   ##
==========================================
+ Coverage   98.75%   98.75%   +<.01%     
==========================================
  Files          48       48              
  Lines        2485     2486       +1     
==========================================
+ Hits         2454     2455       +1     
  Misses         31       31
```


| [Impacted Files](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [jupytext/cli.py](https://codecov.io/gh/mwouts/jupytext/pull/85/diff?src=pr&el=tree#diff-anVweXRleHQvY2xpLnB5) | `98.41% <100%> (+0.02%)` | :arrow_up: |
| [tests/test\_cli.py](https://codecov.io/gh/mwouts/jupytext/pull/85/diff?src=pr&el=tree#diff-dGVzdHMvdGVzdF9jbGkucHk=) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=footer). Last update [960a962...6de92cf](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

codecov[bot]: # [Codecov](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=h1) Report
> Merging [#85](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=desc) into [master](https://codecov.io/gh/mwouts/jupytext/commit/960a962695fa061ed9d6ed103d55c3fbdecb23c1?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/mwouts/jupytext/pull/85/graphs/tree.svg?width=650&token=a1pNjsiILi&height=150&src=pr)](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master      #85      +/-   ##
==========================================
+ Coverage   98.75%   98.75%   +<.01%     
==========================================
  Files          48       48              
  Lines        2485     2486       +1     
==========================================
+ Hits         2454     2455       +1     
  Misses         31       31
```


| [Impacted Files](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [jupytext/cli.py](https://codecov.io/gh/mwouts/jupytext/pull/85/diff?src=pr&el=tree#diff-anVweXRleHQvY2xpLnB5) | `98.41% <100%> (+0.02%)` | :arrow_up: |
| [tests/test\_cli.py](https://codecov.io/gh/mwouts/jupytext/pull/85/diff?src=pr&el=tree#diff-dGVzdHMvdGVzdF9jbGkucHk=) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=footer). Last update [960a962...6de92cf](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

codecov[bot]: # [Codecov](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=h1) Report
> Merging [#85](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=desc) into [master](https://codecov.io/gh/mwouts/jupytext/commit/960a962695fa061ed9d6ed103d55c3fbdecb23c1?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/mwouts/jupytext/pull/85/graphs/tree.svg?width=650&token=a1pNjsiILi&height=150&src=pr)](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master      #85      +/-   ##
==========================================
+ Coverage   98.75%   98.75%   +<.01%     
==========================================
  Files          48       48              
  Lines        2485     2486       +1     
==========================================
+ Hits         2454     2455       +1     
  Misses         31       31
```


| [Impacted Files](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [jupytext/cli.py](https://codecov.io/gh/mwouts/jupytext/pull/85/diff?src=pr&el=tree#diff-anVweXRleHQvY2xpLnB5) | `98.41% <100%> (+0.02%)` | :arrow_up: |
| [tests/test\_cli.py](https://codecov.io/gh/mwouts/jupytext/pull/85/diff?src=pr&el=tree#diff-dGVzdHMvdGVzdF9jbGkucHk=) | `100% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=footer). Last update [960a962...6de92cf](https://codecov.io/gh/mwouts/jupytext/pull/85?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/jupytext/cli.py b/jupytext/cli.py
index df4418db..cbaf20c1 100644
--- a/jupytext/cli.py
+++ b/jupytext/cli.py
@@ -2,6 +2,7 @@
 """
 
 import os
+import sys
 import argparse
 from .jupytext import readf, writef, writes
 from .jupytext import NOTEBOOK_EXTENSIONS
@@ -39,7 +40,7 @@ def convert_notebook_files(nb_files, ext, output=None,
             continue
 
         if output == '-':
-            print(writes(notebook, ext=ext))
+            sys.stdout.write(writes(notebook, ext=ext))
             continue
 
         if output:


Test patch:
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 6d4e0993..01d542af 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -47,7 +47,7 @@ def test_convert_single_file(nb_file, capsys):
 
     out, err = capsys.readouterr()
     assert err == ''
-    compare(out[:-1], pynb)
+    compare(out, pynb)
 
 
 @pytest.mark.parametrize('nb_files', [list_notebooks('ipynb_py')])