summaryrefslogtreecommitdiff
path: root/xnt
diff options
context:
space:
mode:
authorkennyballou <kballou@onyx.boisestate.edu>2012-12-10 11:01:48 -0700
committerkballou <kballou@onyx.boisestate.edu>2012-12-10 11:01:48 -0700
commit86f45dc1b973da7093a60b8f8917bd36e002d40a (patch)
tree5bee962d7f1e05f18b449092042babac29b2759e /xnt
parent1044f1f31f9939458d58598ed4b42ed78a8d6324 (diff)
downloadxnt-86f45dc1b973da7093a60b8f8917bd36e002d40a.tar.gz
xnt-86f45dc1b973da7093a60b8f8917bd36e002d40a.tar.xz
Split tests into separate files
Diffstat (limited to 'xnt')
-rw-r--r--xnt/tests/taskcompressiontests.py42
-rw-r--r--xnt/tests/taskcopytests.py49
-rw-r--r--xnt/tests/taskmisctests.py (renamed from xnt/tests/tasktests.py)43
-rw-r--r--xnt/tests/taskmkdirtests.py45
-rw-r--r--xnt/tests/taskmovetests.py48
-rw-r--r--xnt/tests/taskremovetests.py50
6 files changed, 235 insertions, 42 deletions
diff --git a/xnt/tests/taskcompressiontests.py b/xnt/tests/taskcompressiontests.py
new file mode 100644
index 0000000..90ba081
--- /dev/null
+++ b/xnt/tests/taskcompressiontests.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+# Xnt -- A Wrapper Build Tool
+# Copyright (C) 2012 Kenny Ballou
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import os
+import shutil
+import xnt.tasks
+import unittest
+
+
+class TaskCompressionTests(unittest.TestCase):
+ def setUp(self):
+ os.mkdir("temp")
+ os.mkdir("temp/testfolder1")
+ for i in range(1, 5):
+ with open("temp/testfile" + str(i), "w") as f:
+ f.write("this is a test file")
+
+ def tearDown(self):
+ shutil.rmtree("temp")
+
+ def test_zip(self):
+ xnt.tasks.zip("temp/testfolder1", "temp/myzip.zip")
+ self.assertTrue(os.path.exists("temp/myzip.zip"))
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/xnt/tests/taskcopytests.py b/xnt/tests/taskcopytests.py
new file mode 100644
index 0000000..460ea90
--- /dev/null
+++ b/xnt/tests/taskcopytests.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+# Xnt -- A Wrapper Build Tool
+# Copyright (C) 2012 Kenny Ballou
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import os
+import shutil
+import xnt.tasks
+import unittest
+
+
+class TaskCopyTests(unittest.TestCase):
+ def setUp(self):
+ os.mkdir("temp")
+ os.mkdir("temp/testfolder1")
+ for i in range(1, 5):
+ with open("temp/testfile" + str(i), "w") as f:
+ f.write("this is a test file")
+
+ def tearDown(self):
+ shutil.rmtree("temp")
+
+ def test_cp(self):
+ xnt.tasks.cp("temp/testfolder1", "temp/testfolder2")
+ self.assertTrue(os.path.exists("temp/testfolder2"))
+ self.assertTrue(os.path.exists("temp/testfolder1"))
+ xnt.tasks.cp("temp/testfile1", "temp/testfile5")
+ self.assertTrue(os.path.exists("temp/testfile5"))
+ self.assertTrue(os.path.exists("temp/testfile1"))
+ with open("temp/testfile5", "r") as testfile:
+ self.assertEqual("this is a test file", testfile.read())
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/xnt/tests/tasktests.py b/xnt/tests/taskmisctests.py
index c8dc697..d37ca20 100644
--- a/xnt/tests/tasktests.py
+++ b/xnt/tests/taskmisctests.py
@@ -23,7 +23,7 @@ import xnt.tasks
import unittest
-class TaskTests(unittest.TestCase):
+class TaskMiscTests(unittest.TestCase):
def setUp(self):
os.mkdir("temp")
os.mkdir("temp/testfolder1")
@@ -39,47 +39,6 @@ class TaskTests(unittest.TestCase):
def tearDown(self):
shutil.rmtree("temp")
- def test_cp(self):
- xnt.tasks.cp("temp/testfolder1", "temp/testfolder2")
- self.assertTrue(os.path.exists("temp/testfolder2"))
- self.assertTrue(os.path.exists("temp/testfolder1"))
- xnt.tasks.cp("temp/testfile1", "temp/testfile5")
- self.assertTrue(os.path.exists("temp/testfile5"))
- self.assertTrue(os.path.exists("temp/testfile1"))
- with open("temp/testfile5", "r") as testfile:
- self.assertEqual("this is a test file", testfile.read())
-
- def test_mv(self):
- xnt.tasks.mv("temp/testfolder1", "temp/testfolder2")
- self.assertTrue(os.path.exists("temp/testfolder2"))
- self.assertFalse(os.path.exists("temp/testfolder1"))
- xnt.tasks.mv("temp/testfile1", "temp/testfile5")
- self.assertTrue(os.path.exists("temp/testfile5"))
- self.assertFalse(os.path.exists("temp/testfile1"))
- with open("temp/testfile5", "r") as testfile:
- self.assertEqual("this is a test file", testfile.read())
-
- def test_mkdir(self):
- xnt.tasks.mkdir("temp/mynewtestfolder")
- self.assertTrue(os.path.exists("temp/mynewtestfolder"))
- self.assertTrue(os.path.exists("temp/testfolder1"))
- xnt.tasks.mkdir("temp/testfolder1")
-
- def test_rm(self):
- xnt.tasks.rm("temp/testfolder1")
- self.assertFalse(os.path.exists("temp/testfolder1"))
- xnt.tasks.rm("temp/testfile1")
- self.assertFalse(os.path.exists("temp/testfile1"))
- xnt.tasks.rm("temp/testfile2",
- "temp/testfile3",
- "temp/testfile4")
- for i in range(1, 5):
- self.assertFalse(os.path.exists("temp/testfile" + str(i)))
-
- def test_zip(self):
- xnt.tasks.zip("temp/testfolder1", "temp/myzip.zip")
- self.assertTrue(os.path.exists("temp/myzip.zip"))
-
def test_echo(self):
xnt.tasks.echo("this is my cool echo", "temp/mynewcoolfile")
self.assertTrue(os.path.exists("temp/mynewcoolfile"))
diff --git a/xnt/tests/taskmkdirtests.py b/xnt/tests/taskmkdirtests.py
new file mode 100644
index 0000000..5010c9b
--- /dev/null
+++ b/xnt/tests/taskmkdirtests.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+
+# Xnt -- A Wrapper Build Tool
+# Copyright (C) 2012 Kenny Ballou
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import os
+import shutil
+import xnt.tasks
+import unittest
+
+
+class TaskMkdirTests(unittest.TestCase):
+ def setUp(self):
+ os.mkdir("temp")
+ os.mkdir("temp/testfolder1")
+ for i in range(1, 5):
+ with open("temp/testfile" + str(i), "w") as f:
+ f.write("this is a test file")
+
+ def tearDown(self):
+ shutil.rmtree("temp")
+
+ def test_mkdir(self):
+ xnt.tasks.mkdir("temp/mynewtestfolder")
+ self.assertTrue(os.path.exists("temp/mynewtestfolder"))
+ self.assertTrue(os.path.exists("temp/testfolder1"))
+ xnt.tasks.mkdir("temp/testfolder1")
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/xnt/tests/taskmovetests.py b/xnt/tests/taskmovetests.py
new file mode 100644
index 0000000..e3d9a06
--- /dev/null
+++ b/xnt/tests/taskmovetests.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+# Xnt -- A Wrapper Build Tool
+# Copyright (C) 2012 Kenny Ballou
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import os
+import shutil
+import xnt.tasks
+import unittest
+
+
+class TaskMoveTests(unittest.TestCase):
+ def setUp(self):
+ os.mkdir("temp")
+ os.mkdir("temp/testfolder1")
+ for i in range(1, 5):
+ with open("temp/testfile" + str(i), "w") as f:
+ f.write("this is a test file")
+
+ def tearDown(self):
+ shutil.rmtree("temp")
+
+ def test_mv(self):
+ xnt.tasks.mv("temp/testfolder1", "temp/testfolder2")
+ self.assertTrue(os.path.exists("temp/testfolder2"))
+ self.assertFalse(os.path.exists("temp/testfolder1"))
+ xnt.tasks.mv("temp/testfile1", "temp/testfile5")
+ self.assertTrue(os.path.exists("temp/testfile5"))
+ self.assertFalse(os.path.exists("temp/testfile1"))
+ with open("temp/testfile5", "r") as testfile:
+ self.assertEqual("this is a test file", testfile.read())
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/xnt/tests/taskremovetests.py b/xnt/tests/taskremovetests.py
new file mode 100644
index 0000000..ffeef6d
--- /dev/null
+++ b/xnt/tests/taskremovetests.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+# Xnt -- A Wrapper Build Tool
+# Copyright (C) 2012 Kenny Ballou
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import sys
+import os
+import shutil
+import xnt.tasks
+import unittest
+
+
+class TaskRemoveTests(unittest.TestCase):
+ def setUp(self):
+ os.mkdir("temp")
+ os.mkdir("temp/testfolder1")
+ for i in range(1, 5):
+ with open("temp/testfile" + str(i), "w") as f:
+ f.write("this is a test file")
+
+ def tearDown(self):
+ shutil.rmtree("temp")
+
+ def test_mkdir(self):
+ xnt.tasks.mkdir("temp/mynewtestfolder")
+ self.assertTrue(os.path.exists("temp/mynewtestfolder"))
+ self.assertTrue(os.path.exists("temp/testfolder1"))
+ xnt.tasks.mkdir("temp/testfolder1")
+
+ def test_rm(self):
+ xnt.tasks.rm("temp/testfolder1")
+ self.assertFalse(os.path.exists("temp/testfolder1"))
+ xnt.tasks.rm("temp/testfile1")
+
+
+if __name__ == "__main__":
+ unittest.main()