Skip to content

Commit 964e0b5

Browse files
committed
fix: Read from STDIN
Fixes ietf-tools#36
1 parent b330dfd commit 964e0b5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

svgcheck/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def main():
107107
wp.color_threshold = options.grey_level
108108

109109
if len(args) < 1:
110-
source = os.getcwd() + "/stdin"
110+
source = "/dev/stdin"
111111
else:
112112
source = args[0]
113113
if not os.path.exists(source):

svgcheck/test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ def test_clear_cache(self):
6767
None, None)
6868
self.assertFalse(os.path.exists('Temp/cache/reference.RFC.1847.xml'))
6969

70+
def test_stdin(self):
71+
process = subprocess.Popen([sys.executable, test_program],
72+
stdin=subprocess.PIPE,
73+
stderr=subprocess.PIPE)
74+
_, stderr_data = process.communicate(input=b"<svvvvvg/>")
75+
self.assertEqual(stderr_data.decode("utf-8").strip(),
76+
'INFO: File conforms to SVG requirements.')
77+
7078

7179
class TestParserMethods(unittest.TestCase):
7280

0 commit comments

Comments
 (0)