summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/testparseversions.leading-newline.control6
-rw-r--r--tests/testparseversions.missing.control3
-rw-r--r--tests/testparseversions.nonexported.control4
-rwxr-xr-xtests/testparseversions.py40
-rw-r--r--tests/testparseversions.pycbin0 -> 2148 bytes
-rw-r--r--tests/testparseversions.regular.control4
-rw-r--r--tests/testparseversions.second-paragraph.control4
-rw-r--r--tests/testparseversions.spaces.control4
8 files changed, 65 insertions, 0 deletions
diff --git a/tests/testparseversions.leading-newline.control b/tests/testparseversions.leading-newline.control
new file mode 100644
index 0000000..b0b5a10
--- /dev/null
+++ b/tests/testparseversions.leading-newline.control
@@ -0,0 +1,6 @@
+# comment
+
+Source: source
+XS-Python-Version: >= 2.6
+
+Package: package
diff --git a/tests/testparseversions.missing.control b/tests/testparseversions.missing.control
new file mode 100644
index 0000000..cf6b7fc
--- /dev/null
+++ b/tests/testparseversions.missing.control
@@ -0,0 +1,3 @@
+Source: source
+
+Package: package
diff --git a/tests/testparseversions.nonexported.control b/tests/testparseversions.nonexported.control
new file mode 100644
index 0000000..a8681ff
--- /dev/null
+++ b/tests/testparseversions.nonexported.control
@@ -0,0 +1,4 @@
+Source: source
+X-Python-Version: >= 2.6
+
+Package: package
diff --git a/tests/testparseversions.py b/tests/testparseversions.py
new file mode 100755
index 0000000..4da7084
--- /dev/null
+++ b/tests/testparseversions.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+import unittest
+import subprocess
+
+class TestParseVersions(unittest.TestCase):
+ @staticmethod
+ def get_output(args):
+ subp = subprocess.Popen(args, stdout=subprocess.PIPE)
+ output = subp.communicate()[0]
+ if subp.returncode != 0:
+ raise RuntimeError, subp.returncode
+ return output
+
+ def pv_output(self, control):
+ return TestParseVersions.get_output(["parseversions", "--pycentral", control])
+
+ def test_regular(self):
+ self.assertEqual(self.pv_output('testparseversions.regular.control'),
+ TestParseVersions.get_output(['pyversions', '--supported', '-v']))
+
+ def test_nonexported(self):
+ self.assertEqual(self.pv_output('testparseversions.nonexported.control'),
+ TestParseVersions.get_output(['pyversions', '--supported', '-v']))
+
+ def test_leading_newline(self):
+ self.assertEqual(self.pv_output('testparseversions.leading-newline.control'),
+ TestParseVersions.get_output(['pyversions', '--supported', '-v']))
+
+ def test_missing(self):
+ self.assertRaises(RuntimeError, self.pv_output, 'testparseversions.missing.control')
+
+ def test_second_paragraph(self):
+ self.assertRaises(RuntimeError, self.pv_output, 'testparseversions.second-paragraph.control')
+
+ def test_spaces(self):
+ self.assertRaises(RuntimeError, self.pv_output, 'testparseversions.spaces.control')
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/testparseversions.pyc b/tests/testparseversions.pyc
new file mode 100644
index 0000000..a67f9bc
--- /dev/null
+++ b/tests/testparseversions.pyc
Binary files differ
diff --git a/tests/testparseversions.regular.control b/tests/testparseversions.regular.control
new file mode 100644
index 0000000..549d386
--- /dev/null
+++ b/tests/testparseversions.regular.control
@@ -0,0 +1,4 @@
+Source: source
+XS-Python-Version: >= 2.6
+
+Package: package
diff --git a/tests/testparseversions.second-paragraph.control b/tests/testparseversions.second-paragraph.control
new file mode 100644
index 0000000..6d205a6
--- /dev/null
+++ b/tests/testparseversions.second-paragraph.control
@@ -0,0 +1,4 @@
+Source: source
+
+Package: package
+XS-Python-Version: >= 2.6
diff --git a/tests/testparseversions.spaces.control b/tests/testparseversions.spaces.control
new file mode 100644
index 0000000..f19eea3
--- /dev/null
+++ b/tests/testparseversions.spaces.control
@@ -0,0 +1,4 @@
+Source: source
+
+XS-Python-Version: >= 2.4
+Package: package