diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-10-08 11:12:32 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-10-08 11:17:58 +0300 |
commit | 2414a1def4af92257638d8c2b28bdc4ee4cbe627 (patch) | |
tree | 79ed3e5d23ea3681bd6ae7ebaebc106afad8030f | |
parent | 9966f4076b06902840d1253d2349d48653d6830d (diff) | |
download | releaselogparser-2414a1def4af92257638d8c2b28bdc4ee4cbe627.tar.gz releaselogparser-2414a1def4af92257638d8c2b28bdc4ee4cbe627.tar.bz2 |
Add testsuite
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | MANIFEST.in | 3 | ||||
-rw-r--r-- | releaselog/input.py | 2 | ||||
-rw-r--r-- | setup.py | 12 | ||||
-rw-r--r-- | tests/__init__.py | 9 | ||||
-rw-r--r-- | tests/rlogtester.py | 7 | ||||
-rw-r--r-- | tests/test_cpan.py | 37 | ||||
-rw-r--r-- | tests/test_gnu.py | 62 | ||||
-rw-r--r-- | tests/test_python.py | 34 |
9 files changed, 160 insertions, 8 deletions
@@ -1,6 +1,6 @@ | |||
1 | *~ | 1 | *~ |
2 | *.pyc | 2 | *.pyc |
3 | .emacs.desktop | 3 | .emacs.* |
4 | build/ | 4 | build/ |
5 | dist/ | 5 | dist/ |
6 | tmp/ | 6 | tmp/ |
diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..268ee5b --- /dev/null +++ b/MANIFEST.in | |||
@@ -0,0 +1,3 @@ | |||
1 | exclude .gitignore | ||
2 | include COPYING.txt | ||
3 | include CHANGES.txt | ||
diff --git a/releaselog/input.py b/releaselog/input.py index ebf8ab6..138ba16 100644 --- a/releaselog/input.py +++ b/releaselog/input.py | |||
@@ -30,7 +30,7 @@ class ReleaseLogFile(ReleaseLog): | |||
30 | 30 | ||
31 | 31 | ||
32 | class ReleaseLogURL(ReleaseLog): | 32 | class ReleaseLogURL(ReleaseLog): |
33 | """Read history log entries from a URL file. | 33 | """Read history log entries from a URL. |
34 | Usage: | 34 | Usage: |
35 | 35 | ||
36 | hist = ReleaseLogURL(fmt, url [, args...]) | 36 | hist = ReleaseLogURL(fmt, url [, args...]) |
@@ -18,11 +18,11 @@ | |||
18 | from setuptools import setup, find_packages | 18 | from setuptools import setup, find_packages |
19 | from codecs import open | 19 | from codecs import open |
20 | 20 | ||
21 | #with open("README.rst", "r") as fh: | 21 | with open("README.rst", "r") as fh: |
22 | # long_description = fh.read() | 22 | long_description = fh.read() |
23 | 23 | ||
24 | setup(name='releaselog', | 24 | setup(name='releaselog', |
25 | version='0.2', | 25 | version='0.3', |
26 | author='Sergey Poznyakoff', | 26 | author='Sergey Poznyakoff', |
27 | author_email='gray@gnu.org', | 27 | author_email='gray@gnu.org', |
28 | url='http://git.gnu.org.ua/cgit/gsc/releaselog.git/', | 28 | url='http://git.gnu.org.ua/cgit/gsc/releaselog.git/', |
@@ -31,10 +31,10 @@ setup(name='releaselog', | |||
31 | scripts=['bin/releaselog'], | 31 | scripts=['bin/releaselog'], |
32 | license='GPL License', | 32 | license='GPL License', |
33 | description='Release log parser.', | 33 | description='Release log parser.', |
34 | # long_description=long_description, | 34 | long_description=long_description, |
35 | # long_description_content_type="text/x-rst", | 35 | long_description_content_type="text/x-rst", |
36 | platforms=['any'], | 36 | platforms=['any'], |
37 | # test_suite='tests', | 37 | test_suite='tests', |
38 | classifiers=[ | 38 | classifiers=[ |
39 | 'Development Status :: 4 - Beta', | 39 | 'Development Status :: 4 - Beta', |
40 | 'Intended Audience :: Developers', | 40 | 'Intended Audience :: Developers', |
diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..87f4c50 --- /dev/null +++ b/tests/__init__.py | |||
@@ -0,0 +1,9 @@ | |||
1 | import unittest | ||
2 | import sys | ||
3 | from os.path import dirname, abspath | ||
4 | |||
5 | sys.path.insert(0,dirname(abspath(__file__))) | ||
6 | |||
7 | def test_suite(): | ||
8 | loader = unittest.TestLoader() | ||
9 | return loader.loadTestFromModule() | ||
diff --git a/tests/rlogtester.py b/tests/rlogtester.py new file mode 100644 index 0000000..7e4b374 --- /dev/null +++ b/tests/rlogtester.py | |||
@@ -0,0 +1,7 @@ | |||
1 | import unittest | ||
2 | from releaselog import ReleaseLog | ||
3 | |||
4 | class ReleaseLogTestCase(unittest.TestCase): | ||
5 | def setUp(self): | ||
6 | self.rlog = ReleaseLog(self.type, self.input.split("\n"), | ||
7 | **self.kwargs) | ||
diff --git a/tests/test_cpan.py b/tests/test_cpan.py new file mode 100644 index 0000000..b707c8d --- /dev/null +++ b/tests/test_cpan.py | |||
@@ -0,0 +1,37 @@ | |||
1 | from rlogtester import ReleaseLogTestCase | ||
2 | |||
3 | class CPANReleseLogTestCase(ReleaseLogTestCase): | ||
4 | type = 'CPAN' | ||
5 | kwargs = { } | ||
6 | input = """ | ||
7 | Revision history for Perl extension Config::HAProxy. | ||
8 | |||
9 | 1.02 Mon Jul 16 07:38:31 2018 | ||
10 | - remove the leftover use of autodie | ||
11 | |||
12 | 1.01 Thu Jul 12 09:04:28 2018 | ||
13 | - set minimal required Perl version | ||
14 | - drop dependency on autodie | ||
15 | |||
16 | 1.00 Sun Jul 8 19:57:57 2018 | ||
17 | - original revision | ||
18 | |||
19 | 0.05 2018-05-20 | ||
20 | - experimental version | ||
21 | """ | ||
22 | def test_count(self): | ||
23 | self.assertEqual(len(self.rlog), 4, "wrong count") | ||
24 | |||
25 | def test_recent(self): | ||
26 | elt = self.rlog[0] | ||
27 | self.assertEqual(elt.version, "1.02") | ||
28 | |||
29 | def test_index(self): | ||
30 | elt = self.rlog[2] | ||
31 | self.assertEqual(elt.version, "1.00") | ||
32 | |||
33 | if __name__ == '__main__': | ||
34 | unittest.main() | ||
35 | |||
36 | |||
37 | |||
diff --git a/tests/test_gnu.py b/tests/test_gnu.py new file mode 100644 index 0000000..090949c --- /dev/null +++ b/tests/test_gnu.py | |||
@@ -0,0 +1,62 @@ | |||
1 | from rlogtester import ReleaseLogTestCase | ||
2 | |||
3 | class GNUReleseLogTestCase(ReleaseLogTestCase): | ||
4 | type = 'GNU' | ||
5 | kwargs = { } | ||
6 | input = """ | ||
7 | GNU mailutils NEWS -- history of user-visible changes. 2018-08-29 | ||
8 | Copyright (C) 2002-2018 Free Software Foundation, Inc. | ||
9 | See the end of file for copying conditions. | ||
10 | |||
11 | Please send mailutils bug reports to <bug-mailutils@gnu.org>. | ||
12 | |||
13 | Version 3.5.90 (Git) | ||
14 | |||
15 | * Bugfixes | ||
16 | |||
17 | Version 3.5, 2018-08-29 | ||
18 | |||
19 | * Support for Guile version 2.2.0 and later | ||
20 | |||
21 | Support for prior versions has been withdrawn. | ||
22 | |||
23 | * New scheme functions | ||
24 | |||
25 | ** mu-encoder-port port name . args | ||
26 | |||
27 | Version 3.4 - 2017-11-02 | ||
28 | |||
29 | * Fix AM_MAILUTILS macro | ||
30 | |||
31 | The macro incorrectly compared three-part version number with a | ||
32 | two-part argument. | ||
33 | |||
34 | Version 3.3 - Sergey Poznyakoff, 2017-10-18 | ||
35 | |||
36 | * TLS configuration | ||
37 | |||
38 | Some changes to the TLS configuration | ||
39 | |||
40 | Version 3.2 - 2017-03-11 | ||
41 | |||
42 | * configuration syntax | ||
43 | |||
44 | Statements that allow for variable substitution also allow for command | ||
45 | expansion. Commands are invoked the same way as in shell. | ||
46 | """ | ||
47 | |||
48 | def test_count(self): | ||
49 | self.assertEqual(len(self.rlog), 4, "wrong count") | ||
50 | |||
51 | def test_recent(self): | ||
52 | elt = self.rlog[0] | ||
53 | self.assertEqual(elt.version, "3.5") | ||
54 | |||
55 | def test_index(self): | ||
56 | elt = self.rlog[2] | ||
57 | self.assertEqual(elt.version, "3.3") | ||
58 | |||
59 | if __name__ == '__main__': | ||
60 | unittest.main() | ||
61 | |||
62 | |||
diff --git a/tests/test_python.py b/tests/test_python.py new file mode 100644 index 0000000..904cc82 --- /dev/null +++ b/tests/test_python.py | |||
@@ -0,0 +1,34 @@ | |||
1 | # -*- coding: utf-8 -*- | ||
2 | from rlogtester import ReleaseLogTestCase | ||
3 | |||
4 | class PythonReleseLogTestCase(ReleaseLogTestCase): | ||
5 | type = 'python' | ||
6 | kwargs = { } | ||
7 | input = """ | ||
8 | v1.3, 2018-09-01 -- Don't throw exception on invalid tokens. | ||
9 | Fix python 3 compatibility | ||
10 | v1.2, 2018-08-27 -- Fix handling of unrecognized closing tags. | ||
11 | v1.1, 2018-08-24 -- Initialize token_class dynamically. | ||
12 | v1.0, 2018-08-19 -- Initial release. | ||
13 | |||
14 | """ | ||
15 | |||
16 | def test_count(self): | ||
17 | self.assertEqual(len(self.rlog), 4, "wrong count") | ||
18 | |||
19 | def test_recent(self): | ||
20 | elt = self.rlog[0] | ||
21 | self.assertEqual(elt.version, "1.3") | ||
22 | |||
23 | def test_index(self): | ||
24 | elt = self.rlog[2] | ||
25 | self.assertEqual(elt.version, "1.1") | ||
26 | |||
27 | def test_descr(self): | ||
28 | self.assertEqual('\n'.join(self.rlog[0].descr),"""Don't throw exception on invalid tokens. | ||
29 | Fix python 3 compatibility""") | ||
30 | self.assertEqual('\n'.join(self.rlog[2].descr),"Initialize token_class dynamically.") | ||
31 | |||
32 | if __name__ == '__main__': | ||
33 | unittest.main() | ||
34 | |||