From 70f1c6c12d6b52d69eb0ab8335161e36cc11fbb6 Mon Sep 17 00:00:00 2001 From: fitnr Date: Thu, 30 Nov 2017 17:13:39 -0500 Subject: [PATCH] add specificity to test --- tests/test_cli.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 4ebd685..a5065fc 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -88,13 +88,17 @@ def testCliDraw(self): os.remove('tmp.svg') def testDrawProjected(self): - self.invoke(['draw', self.dc, '--output', 'tmp.svg', '--precision', '10']) + f = os.path.expanduser('~/tmp.svg') + result = self.invoke(['draw', self.dc, '--output', f, '--precision', '10']) + + self.assertEqual(result.exit_code, 0) + self.assertTrue(os.path.exists(f)) try: - with open('tmp.svg') as f: - svg = f.read() + with open(f) as g: + svg = g.read() match = re.search(r'points="([^"]+)"', svg) - assert match + self.assertIsNotNone(match) result = match.groups()[0] points = [[float(x) for x in p.split(',')] for p in result.split(' ')] @@ -106,7 +110,7 @@ def testDrawProjected(self): self.assertAlmostEqual(*z) finally: - os.remove('tmp.svg') + os.remove(f) def testCliHelp(self): result = self.invoke(('--help',))