Skip to content

Commit

Permalink
Attempt to fix travis tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrimko committed Apr 21, 2020
1 parent a079e08 commit 4ecdd0d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
language: python
before_install:
- "pip install auxly"
python:
- "2.7"
- "3.5"
Expand Down
20 changes: 10 additions & 10 deletions tests/script_test_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
class TestCase(unittest.TestCase):

def _cleanup(test):
filesys.File("foo").delete()
filesys.File("bar").delete()
filesys.File("caz").delete()
rmfile("foo")
rmfile("bar")
rmfile("caz")

def setUp(test):
test._cleanup()
Expand All @@ -35,49 +35,49 @@ def tearDown(test):
test._cleanup()

def test_script_1(test):
result = shell.call(f"python {SCRIPT} x")
result = os.system(f"python {SCRIPT} x")
test.assertEqual(0, result)
test.assertFalse(op.exists("foo"))
test.assertFalse(op.exists("bar"))
test.assertFalse(op.exists("caz"))

def test_script_2(test):
result = shell.call(f"python {SCRIPT} f")
result = os.system(f"python {SCRIPT} f")
test.assertEqual(0, result)
test.assertTrue(op.exists("foo"))
test.assertFalse(op.exists("bar"))
test.assertFalse(op.exists("caz"))

def test_script_3(test):
result = shell.call(f"python {SCRIPT} b")
result = os.system(f"python {SCRIPT} b")
test.assertEqual(0, result)
test.assertFalse(op.exists("foo"))
test.assertTrue(op.exists("bar"))
test.assertFalse(op.exists("caz"))

def test_script_4(test):
result = shell.call(f"python {SCRIPT} f b")
result = os.system(f"python {SCRIPT} f b")
test.assertEqual(0, result)
test.assertTrue(op.exists("foo"))
test.assertTrue(op.exists("bar"))
test.assertFalse(op.exists("caz"))

def test_script_5(test):
result = shell.call(f"python {SCRIPT} c")
result = os.system(f"python {SCRIPT} c")
test.assertEqual(0, result)
test.assertFalse(op.exists("foo"))
test.assertFalse(op.exists("bar"))
test.assertTrue(op.exists("caz"))

def test_script_6(test):
result = shell.call(f"python {SCRIPT} c f")
result = os.system(f"python {SCRIPT} c f")
test.assertEqual(0, result)
test.assertTrue(op.exists("foo"))
test.assertFalse(op.exists("bar"))
test.assertTrue(op.exists("caz"))

def test_script_7(test):
result = shell.call(f"python {SCRIPT} -d")
result = os.system(f"python {SCRIPT} -d")
test.assertEqual(0, result)
test.assertFalse(op.exists("foo"))
test.assertTrue(op.exists("bar"))
Expand Down
22 changes: 10 additions & 12 deletions tests/script_test_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

from testlib import *

from auxly import shell, filesys

##==============================================================#
## SECTION: Global Definitions #
##==============================================================#
Expand All @@ -21,9 +19,9 @@
class TestCase(unittest.TestCase):

def _cleanup(test):
filesys.File("foo").delete()
filesys.File("bar").delete()
filesys.File("caz").delete()
rmfile("foo")
rmfile("bar")
rmfile("caz")

def setUp(test):
test._cleanup()
Expand All @@ -35,49 +33,49 @@ def tearDown(test):
test._cleanup()

def test_script_1(test):
result = shell.call(f"python {SCRIPT} x")
result = os.system(f"python {SCRIPT} x")
test.assertEqual(0, result)
test.assertFalse(op.exists("foo"))
test.assertFalse(op.exists("bar"))
test.assertFalse(op.exists("caz"))

def test_script_2(test):
result = shell.call(f"python {SCRIPT} f")
result = os.system(f"python {SCRIPT} f")
test.assertEqual(0, result)
test.assertTrue(op.exists("foo"))
test.assertFalse(op.exists("bar"))
test.assertFalse(op.exists("caz"))

def test_script_3(test):
result = shell.call(f"python {SCRIPT} b")
result = os.system(f"python {SCRIPT} b")
test.assertEqual(0, result)
test.assertFalse(op.exists("foo"))
test.assertTrue(op.exists("bar"))
test.assertFalse(op.exists("caz"))

def test_script_4(test):
result = shell.call(f"python {SCRIPT} f b")
result = os.system(f"python {SCRIPT} f b")
test.assertEqual(0, result)
test.assertTrue(op.exists("foo"))
test.assertFalse(op.exists("bar"))
test.assertFalse(op.exists("caz"))

def test_script_5(test):
result = shell.call(f"python {SCRIPT} c")
result = os.system(f"python {SCRIPT} c")
test.assertEqual(0, result)
test.assertFalse(op.exists("foo"))
test.assertFalse(op.exists("bar"))
test.assertTrue(op.exists("caz"))

def test_script_6(test):
result = shell.call(f"python {SCRIPT} c f")
result = os.system(f"python {SCRIPT} c f")
test.assertEqual(0, result)
test.assertFalse(op.exists("foo"))
test.assertFalse(op.exists("bar"))
test.assertTrue(op.exists("caz"))

def test_script_7(test):
result = shell.call(f"python {SCRIPT} -d")
result = os.system(f"python {SCRIPT} -d")
test.assertEqual(0, result)
test.assertFalse(op.exists("foo"))
test.assertTrue(op.exists("bar"))
Expand Down
9 changes: 9 additions & 0 deletions tests/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,12 @@
sys.stdin.write(x),
sys.stdin.seek(0)]
#----}

##==============================================================#
## SECTION: Function Definitions #
##==============================================================#

def rmfile(fname):
"""Delete a file if it exists."""
if op.isfile(fname):
os.remove(fname)

0 comments on commit 4ecdd0d

Please sign in to comment.