aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-10-08 11:12:32 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-10-08 11:17:58 +0300
commit2414a1def4af92257638d8c2b28bdc4ee4cbe627 (patch)
tree79ed3e5d23ea3681bd6ae7ebaebc106afad8030f
parent9966f4076b06902840d1253d2349d48653d6830d (diff)
downloadreleaselogparser-2414a1def4af92257638d8c2b28bdc4ee4cbe627.tar.gz
releaselogparser-2414a1def4af92257638d8c2b28bdc4ee4cbe627.tar.bz2
Add testsuite
-rw-r--r--.gitignore2
-rw-r--r--MANIFEST.in3
-rw-r--r--releaselog/input.py2
-rw-r--r--setup.py12
-rw-r--r--tests/__init__.py9
-rw-r--r--tests/rlogtester.py7
-rw-r--r--tests/test_cpan.py37
-rw-r--r--tests/test_gnu.py62
-rw-r--r--tests/test_python.py34
9 files changed, 160 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 5f2763b..4dea9de 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
1*~ 1*~
2*.pyc 2*.pyc
3.emacs.desktop 3.emacs.*
4build/ 4build/
5dist/ 5dist/
6tmp/ 6tmp/
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..268ee5b
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,3 @@
1exclude .gitignore
2include COPYING.txt
3include 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
32class ReleaseLogURL(ReleaseLog): 32class 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...])
diff --git a/setup.py b/setup.py
index 9844af3..37a2b41 100644
--- a/setup.py
+++ b/setup.py
@@ -18,11 +18,11 @@
18from setuptools import setup, find_packages 18from setuptools import setup, find_packages
19from codecs import open 19from codecs import open
20 20
21#with open("README.rst", "r") as fh: 21with open("README.rst", "r") as fh:
22# long_description = fh.read() 22 long_description = fh.read()
23 23
24setup(name='releaselog', 24setup(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 @@
1import unittest
2import sys
3from os.path import dirname, abspath
4
5sys.path.insert(0,dirname(abspath(__file__)))
6
7def 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 @@
1import unittest
2from releaselog import ReleaseLog
3
4class 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 @@
1from rlogtester import ReleaseLogTestCase
2
3class CPANReleseLogTestCase(ReleaseLogTestCase):
4 type = 'CPAN'
5 kwargs = { }
6 input = """
7Revision history for Perl extension Config::HAProxy.
8
91.02 Mon Jul 16 07:38:31 2018
10 - remove the leftover use of autodie
11
121.01 Thu Jul 12 09:04:28 2018
13 - set minimal required Perl version
14 - drop dependency on autodie
15
161.00 Sun Jul 8 19:57:57 2018
17 - original revision
18
190.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
33if __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 @@
1from rlogtester import ReleaseLogTestCase
2
3class GNUReleseLogTestCase(ReleaseLogTestCase):
4 type = 'GNU'
5 kwargs = { }
6 input = """
7GNU mailutils NEWS -- history of user-visible changes. 2018-08-29
8Copyright (C) 2002-2018 Free Software Foundation, Inc.
9See the end of file for copying conditions.
10
11Please send mailutils bug reports to <bug-mailutils@gnu.org>.
12
13Version 3.5.90 (Git)
14
15* Bugfixes
16
17Version 3.5, 2018-08-29
18
19* Support for Guile version 2.2.0 and later
20
21Support for prior versions has been withdrawn.
22
23* New scheme functions
24
25** mu-encoder-port port name . args
26
27Version 3.4 - 2017-11-02
28
29* Fix AM_MAILUTILS macro
30
31The macro incorrectly compared three-part version number with a
32two-part argument.
33
34Version 3.3 - Sergey Poznyakoff, 2017-10-18
35
36* TLS configuration
37
38Some changes to the TLS configuration
39
40Version 3.2 - 2017-03-11
41
42* configuration syntax
43
44Statements that allow for variable substitution also allow for command
45expansion. 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
59if __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 -*-
2from rlogtester import ReleaseLogTestCase
3
4class PythonReleseLogTestCase(ReleaseLogTestCase):
5 type = 'python'
6 kwargs = { }
7 input = """
8v1.3, 2018-09-01 -- Don't throw exception on invalid tokens.
9 Fix python 3 compatibility
10v1.2, 2018-08-27 -- Fix handling of unrecognized closing tags.
11v1.1, 2018-08-24 -- Initialize token_class dynamically.
12v1.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
32if __name__ == '__main__':
33 unittest.main()
34

Return to:

Send suggestions and report system problems to the System administrator.