summaryrefslogtreecommitdiff
path: root/python/samba/subunit
AgeCommit message (Collapse)AuthorFilesLines
2021-06-11python:subunit: Avoid misleading "Test was never started" error messageJoseph Sutton1-67/+84
subunithelper.py keeps track of tests that have been started, and displays an error message if a test reports an outcome without having previously been started. However, it makes the assumption that a test has finished once it has reported a single outcome. This means that a misleading error message will be displayed if it receives multiple outcomes from the same test (which can happen if a test using the Python unittest framework does not complete successfully, and the cleanup subsequently fails), and any actual errors from the cleanup remain undisplayed. This commit ensures that only a single outcome is reported for each test, and only after the test has finished. Outcomes are buffered up until the stopTest() function is called, when a single outcome is determined and all errors received for that test are output. FilterOps still needs to output test outcomes immediately rather than buffering them, otherwise they are never picked up and passed on to the remote test case by subunithelper.parse_results(). This would result in an error as the test would be considered to have never finished. Example subunitrun output before the change: time: 2021-04-28 01:28:49.862123Z test: samba.tests.example.ExampleTests.test time: 2021-04-28 01:28:49.862215Z failure: samba.tests.example.ExampleTests.test [ Traceback (most recent call last): File "bin/python/samba/tests/example.py", line 28, in test self.fail() AssertionError: None ] time: 2021-04-28 01:28:49.862407Z failure: samba.tests.example.ExampleTests.test [ Traceback (most recent call last): File "bin/python/samba/tests/example.py", line 31, in tearDown self.fail() AssertionError: None ] time: 2021-04-28 01:28:49.862467Z time: 2021-04-28 01:28:49.862510Z and after: time: 2021-04-28 01:29:19.949347Z test: samba.tests.example.ExampleTests.test time: 2021-04-28 01:29:19.949440Z time: 2021-04-28 01:29:19.949590Z time: 2021-04-28 01:29:19.949640Z failure: samba.tests.example.ExampleTests.test [ Traceback (most recent call last): File "bin/python/samba/tests/example.py", line 28, in test self.fail() AssertionError: None Traceback (most recent call last): File "bin/python/samba/tests/example.py", line 31, in tearDown self.fail() AssertionError: None ] time: 2021-04-28 01:29:19.949702Z Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-06-11python:subunit: Remove write_traceback()Joseph Sutton1-44/+7
This functionality is already present in the Python unittest framework, and so is not necessary to include here. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-06-11python:subunit: Fix skipping a test with no reason givenJoseph Sutton1-2/+2
Not specifying a reason means addSkip() is passed an empty string rather than None. As a result, this condition was never hit, and the call to _addOutcome() had an incorrect parameter. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-02-02selftest: Directly import python-iso8601Andreas Schneider1-3/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-02-02python:subunit: Use UTC timezone from datatime moduleAndreas Schneider1-4/+2
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2020-08-21python: Remove remaining references to third_party python libsAndrew Bartlett1-1/+0
For now at least we do not have any in third_party. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Aug 21 00:12:52 UTC 2020 on sn-devel-184
2019-03-07subunit/run.py: change shebang to python3Joe Guo1-1/+1
always use explicit python version at current stage. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Thu Mar 7 13:03:56 UTC 2019 on sn-devel-144
2019-03-07subunit/run.py: make iso8601 UTC usage python 2/3 compatibleJoe Guo1-3/+3
In `iso8601/iso8601.py`: if sys.version_info >= (3, 2, 0): UTC = datetime.timezone.utc ... else: class Utc(datetime.tzinfo): ... UTC = Utc() The class `Utc` is only available for python < 3.2.0. Use `UTC` instance instead, which is python 2/3 compatible. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <npower@samba.org>
2018-08-24PEP8: fix E701: multiple statements on one line (colon)Joe Guo1-1/+2
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E211: whitespace before '('Joe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-08-24PEP8: fix E128: continuation line under-indented for visual indentJoe Guo1-1/+1
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-04-13python: bulk replace file to open for py3Joe Guo1-1/+1
The builtin function `file` was removed in py3. Use `open` instead. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-02-09subunit.run: report failure in process return codeDouglas Bagnall1-0/+7
The protocol requires that the TestResult object remembers when it has failed, but in subclassing unittest.TestResult we forgot to ensure this is true. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-12-01python: samba.subunit.run: Fix Python 3 compatibility.Lumir Balhar1-8/+2
Usage of function _test_id() which generates test id in bytes breaks Python 3 compatibility. After fix, this function is not used any more. Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-03-06Drop support for failfast mode, rather than adding support for it everywhere.Jelmer Vernooij1-38/+7
Change-Id: I4d6070a0e3b89d5e390f84754dddba9ec17ddf21 Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-03-06Support using third party iso8601 module if system doesn't provide one.Jelmer Vernooij1-0/+5
Change-Id: I5d035738d244d66d33788636c8ee8b322c227a0e Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-03-06Import UTC definition from utc8601 module.Jelmer Vernooij2-24/+3
Change-Id: I3ccd81090c4721b161aff272100aa71bc2f17055 Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-03-06Set default testRunner rather than requiring the user pass it in.Jelmer Vernooij1-2/+3
Change-Id: I8b5a5925030049975a83b090e5c7b76d5245c07d Signed-Off-By: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-03-06Add RemoteTestCase and RemoteError to samba.subunit.Jelmer Vernooij1-0/+59
Change-Id: Ib3946cf4eae69f53270a299660f6029290d3791a Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-03-06Use Samba-only subunit module in selftest/tests/.Jelmer Vernooij2-19/+30
Change-Id: I48c61f975c1fa49f6e244ad39dd720fe507db45b Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-03-06Fix copyright headers for python/samba/subunit.Jelmer Vernooij1-0/+18
Change-Id: I5b554051f23f31d20b4f4325debcd6717ba8369e Signed-Off-By: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-03-06Add simple subunit runner outputting subunit v1.Jelmer Vernooij2-0/+750
This is a short module (< 1k lines) that removes the need to depend on subunit, testtools, extras and mimeparse. It is based on an extract from testtools and subunit. Change-Id: I0a4f3060b25f7bde602a07ed6bef71c8196fca64 Signed-Off-By: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>