Skip to content

Commit

Permalink
fix: Read from STDIN
Browse files Browse the repository at this point in the history
  • Loading branch information
kesara committed Oct 3, 2024
1 parent b330dfd commit 964e0b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion svgcheck/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def main():
wp.color_threshold = options.grey_level

if len(args) < 1:
source = os.getcwd() + "/stdin"
source = "/dev/stdin"
else:
source = args[0]
if not os.path.exists(source):
Expand Down
8 changes: 8 additions & 0 deletions svgcheck/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ def test_clear_cache(self):
None, None)
self.assertFalse(os.path.exists('Temp/cache/reference.RFC.1847.xml'))

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


class TestParserMethods(unittest.TestCase):

Expand Down

0 comments on commit 964e0b5

Please sign in to comment.