aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2017-08-04 12:09:37 +0200
committerSimon Warta <[email protected]>2017-08-04 12:09:37 +0200
commit9de1b430d4b2ece9ab6cb1efb3d50867b42b0018 (patch)
treeea4b0e5975f24ece5ca23d0aa1ad367fd39325f7 /src
parent75413ec81ed672ee78dabe49a83e79e7a02ad5f7 (diff)
Pull out python_unittests_unix.py
The path tests can only work on UNIX-like OSs because Python's path joining is required to use / as the path separator
Diffstat (limited to 'src')
-rwxr-xr-xsrc/scripts/ci/travis/lint.sh4
-rwxr-xr-xsrc/scripts/python_uniitests.py31
-rwxr-xr-xsrc/scripts/python_unittests_unix.py51
3 files changed, 56 insertions, 30 deletions
diff --git a/src/scripts/ci/travis/lint.sh b/src/scripts/ci/travis/lint.sh
index df9288b36..92a75c026 100755
--- a/src/scripts/ci/travis/lint.sh
+++ b/src/scripts/ci/travis/lint.sh
@@ -24,6 +24,10 @@ echo "travis_fold:start:pylint_python_unittests"
python3_pylint src/scripts/python_uniitests.py
echo "travis_fold:end:pylint_python_unittests"
+echo "travis_fold:start:pylint_python_unittests_unix"
+python3_pylint src/scripts/python_unittests_unix.py
+echo "travis_fold:end:pylint_python_unittests_unix"
+
echo "travis_fold:start:pylint_botanpy"
python2_pylint src/python/botan2.py
python3_pylint src/python/botan2.py
diff --git a/src/scripts/python_uniitests.py b/src/scripts/python_uniitests.py
index c804fae83..fff32e03f 100755
--- a/src/scripts/python_uniitests.py
+++ b/src/scripts/python_uniitests.py
@@ -10,14 +10,13 @@ Requires Python 3.
Botan is released under the Simplified BSD License (see license.txt)
"""
-import os
import sys
import unittest
sys.path.append("../..") # Botan repo root
from configure import CompilerDetector # pylint: disable=wrong-import-position
from configure import ModulesChooser # pylint: disable=wrong-import-position
-from install import prepend_destdir # pylint: disable=wrong-import-position
+
class CompilerDetection(unittest.TestCase):
@@ -270,34 +269,6 @@ class ModulesChooserResolveDependencies(unittest.TestCase):
self.assertEqual(modules, set(["G", "A", "C", "E"]))
-class PrependDestdir(unittest.TestCase):
- def test_base(self):
- os.environ["DESTDIR"] = "/"
- self.assertEqual(prepend_destdir("/home/me"), "/home/me")
- self.assertEqual(prepend_destdir("relative_path"), "/relative_path")
- self.assertEqual(prepend_destdir("./relative_path"), "/relative_path")
- self.assertEqual(prepend_destdir("relative/sub"), "/relative/sub")
-
- self.assertEqual(prepend_destdir("/home/me/"), "/home/me")
- self.assertEqual(prepend_destdir("relative_path/"), "/relative_path")
-
- self.assertEqual(prepend_destdir("/home/me/../me2"), "/home/me2")
- self.assertEqual(prepend_destdir("relative/sub/../sub2"), "/relative/sub2")
-
- os.environ["DESTDIR"] = "/opt"
- self.assertEqual(prepend_destdir("/home/me"), "/opt/home/me")
- self.assertEqual(prepend_destdir("relative_path"), "/opt/relative_path")
- self.assertEqual(prepend_destdir("./relative_path"), "/opt/relative_path")
- self.assertEqual(prepend_destdir("relative/sub"), "/opt/relative/sub")
-
- self.assertEqual(prepend_destdir("/home/me/"), "/opt/home/me")
- self.assertEqual(prepend_destdir("relative_path/"), "/opt/relative_path")
-
- self.assertEqual(prepend_destdir("/home/me/../me2"), "/opt/home/me2")
- self.assertEqual(prepend_destdir("relative/sub/../sub2"), "/opt/relative/sub2")
-
-
-
if __name__ == '__main__':
unittest.TestCase.longMessage = True
unittest.main()
diff --git a/src/scripts/python_unittests_unix.py b/src/scripts/python_unittests_unix.py
new file mode 100755
index 000000000..a8015d081
--- /dev/null
+++ b/src/scripts/python_unittests_unix.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+
+"""
+Unittests for Botan Python scripts. Those tests only need to pass un UNIX-like
+operating systems.
+
+Requires Python 3.
+
+(C) 2017 Simon Warta (Kullo GmbH)
+
+Botan is released under the Simplified BSD License (see license.txt)
+"""
+
+import os
+import sys
+import unittest
+
+sys.path.append("../..") # Botan repo root
+from install import prepend_destdir # pylint: disable=wrong-import-position
+
+
+class PrependDestdir(unittest.TestCase):
+ def test_base(self):
+ os.environ["DESTDIR"] = "/"
+ self.assertEqual(prepend_destdir("/home/me"), "/home/me")
+ self.assertEqual(prepend_destdir("relative_path"), "/relative_path")
+ self.assertEqual(prepend_destdir("./relative_path"), "/relative_path")
+ self.assertEqual(prepend_destdir("relative/sub"), "/relative/sub")
+
+ self.assertEqual(prepend_destdir("/home/me/"), "/home/me")
+ self.assertEqual(prepend_destdir("relative_path/"), "/relative_path")
+
+ self.assertEqual(prepend_destdir("/home/me/../me2"), "/home/me2")
+ self.assertEqual(prepend_destdir("relative/sub/../sub2"), "/relative/sub2")
+
+ os.environ["DESTDIR"] = "/opt"
+ self.assertEqual(prepend_destdir("/home/me"), "/opt/home/me")
+ self.assertEqual(prepend_destdir("relative_path"), "/opt/relative_path")
+ self.assertEqual(prepend_destdir("./relative_path"), "/opt/relative_path")
+ self.assertEqual(prepend_destdir("relative/sub"), "/opt/relative/sub")
+
+ self.assertEqual(prepend_destdir("/home/me/"), "/opt/home/me")
+ self.assertEqual(prepend_destdir("relative_path/"), "/opt/relative_path")
+
+ self.assertEqual(prepend_destdir("/home/me/../me2"), "/opt/home/me2")
+ self.assertEqual(prepend_destdir("relative/sub/../sub2"), "/opt/relative/sub2")
+
+
+if __name__ == '__main__':
+ unittest.TestCase.longMessage = True
+ unittest.main()