Skip to content

Commit

Permalink
test(multi): Rearrange files as requested in review
Browse files Browse the repository at this point in the history
  • Loading branch information
gwhitney authored and t0b3 committed Jul 12, 2022
1 parent 65d117e commit 0c8942b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes
29 changes: 29 additions & 0 deletions test/test_multi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/env python

import unittest
import subprocess
import sys
from pathlib import Path
import difflib


class TestMulti(unittest.TestCase):

def test_01multi_nogui(self):
try:
# The -Wignore flag to Python is for the sake of an
# inkscape-internal use of a deprecated Python construct. When
# we are no longer testing on the offending version of Inkscape
# (1.2 as released), it can be removed.
commands = subprocess.run([sys.executable, "-Wignore::DeprecationWarning", "silhouette_multi.py", "--block=true", "-d=true", "-g=false", "-p=test/data/multi.cPickle", "test/data/multi_color.svg"], check=True, capture_output=True).stderr.decode().replace("\r","")
commandref = Path("./test/data/multi.commands").read_text()
if (commandref != commands):
diffs = difflib.context_diff(
commandref.split(), commands.split())
sys.stdout.writelines(diffs)
self.assertEqual(commandref, commands)
except subprocess.CalledProcessError as e:
print(e.output.decode())
print(e)
self.assertEqual(e.returncode, 0)
assert False
21 changes: 0 additions & 21 deletions test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import unittest
import subprocess
import sys
from pathlib import Path
import os
import difflib


class TestRun(unittest.TestCase):
Expand Down Expand Up @@ -132,22 +130,3 @@ def test_08cmd_file(self):
print(e)
self.assertEqual(e.returncode, 0)
assert False

def test_09multi_nogui(self):
try:
# The -Wignore flag to Python is for the sake of an
# inkscape-internal use of a deprecated Python construct. When
# we are no longer testing on the offending version of Inkscape
# (1.2 as released), it can be removed.
commands = subprocess.run([sys.executable, "-Wignore::DeprecationWarning", "silhouette_multi.py", "--block=true", "-d=true", "-g=false", "-p=examples/multi.cPickle", "examples/multi_color.svg"], check=True, capture_output=True).stderr.decode().replace("\r","")
commandref = Path("./examples/multi.commands").read_text()
if (commandref != commands):
diffs = difflib.context_diff(
commandref.split(), commands.split())
sys.stdout.writelines(diffs)
self.assertEqual(commandref, commands)
except subprocess.CalledProcessError as e:
print(e.output.decode())
print(e)
self.assertEqual(e.returncode, 0)
assert False

0 comments on commit 0c8942b

Please sign in to comment.