Skip to content

Commit d7afe73

Browse files
committed
Small (subjective) clean-up in tests.
1 parent 663ea47 commit d7afe73

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

bpython/test/test_args.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import unittest
22
import subprocess
3-
import tempfile
43
import sys
5-
6-
4+
import tempfile
5+
from textwrap import dedent
76

87

98
class TestExecArgs(unittest.TestCase):
109
def test_exec_dunder_file(self):
11-
with tempfile.NamedTemporaryFile(delete=False) as f:
12-
f.write(
13-
"import sys; sys.stderr.write(__file__); sys.stderr.flush();".encode('ascii'))
10+
with tempfile.NamedTemporaryFile(delete=False, mode="w") as f:
11+
f.write(dedent("""\
12+
import sys
13+
sys.stderr.write(__file__)
14+
sys.stderr.flush()"""))
1415
f.flush()
15-
p = subprocess.Popen(['bpython-curtsies', f.name], stderr=subprocess.PIPE)
16-
17-
self.assertEquals(p.stderr.read().strip().decode('ascii'), f.name)
18-
16+
p = subprocess.Popen(
17+
[sys.executable, "-m", "bpython.curtsies", f.name],
18+
stderr=subprocess.PIPE,
19+
universal_newlines=True)
20+
(_, stderr) = p.communicate()
1921

22+
self.assertEquals(stderr.strip(), f.name)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy