summaryrefslogtreecommitdiffstats
path: root/selftest
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2014-12-11 01:55:16 +0000
committerAndrew Bartlett <abartlet@samba.org>2015-03-06 04:41:46 +0100
commit8487f4afc1b514942f90b8f384b11f2cd66565fc (patch)
tree2a0d19a5b9acf64674cc6bedd4e225776a0dec2b /selftest
parent9a1a34451f5c9fff702f43168e3d20df24acec41 (diff)
downloadsamba-8487f4afc1b514942f90b8f384b11f2cd66565fc.tar.gz
samba-8487f4afc1b514942f90b8f384b11f2cd66565fc.tar.xz
samba-8487f4afc1b514942f90b8f384b11f2cd66565fc.zip
Use Samba-only subunit module in selftest/tests/.
Change-Id: I48c61f975c1fa49f6e244ad39dd720fe507db45b Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'selftest')
-rw-r--r--selftest/run.py5
-rw-r--r--selftest/tests/test_run.py17
2 files changed, 12 insertions, 10 deletions
diff --git a/selftest/run.py b/selftest/run.py
index 222ac8b1a8..b7638f0daa 100644
--- a/selftest/run.py
+++ b/selftest/run.py
@@ -18,10 +18,9 @@
"""Test command running."""
import datetime
-from subunit import iso8601
import os
import subprocess
-import subunit
+from samba import subunit
import sys
import tempfile
import warnings
@@ -89,7 +88,7 @@ def exported_envvars_str(vars, names):
def now():
"""Return datetime instance for current time in UTC.
"""
- return datetime.datetime.utcnow().replace(tzinfo=iso8601.Utc())
+ return datetime.datetime.utcnow().replace(tzinfo=subunit.UTC())
def run_testsuite_command(name, cmd, subunit_ops, env=None, outf=None):
diff --git a/selftest/tests/test_run.py b/selftest/tests/test_run.py
index 35f99e83c7..829f488cf8 100644
--- a/selftest/tests/test_run.py
+++ b/selftest/tests/test_run.py
@@ -21,7 +21,10 @@
import datetime
import os
-import subunit
+from samba.subunit import (
+ PROGRESS_PUSH,
+ PROGRESS_POP,
+ )
import tempfile
from selftest.run import (
@@ -133,10 +136,10 @@ class RunTestsuiteCommandTests(TestCase):
exit_code = run_testsuite_command("thetestsuitename", "echo doing something", subunit_ops, outf=outf)
self.assertEquals([
("start-testsuite", "thetestsuitename"),
- ("progress", None, subunit.PROGRESS_PUSH),
+ ("progress", None, PROGRESS_PUSH),
("time", ),
("time", ),
- ("progress", None, subunit.PROGRESS_POP),
+ ("progress", None, PROGRESS_POP),
("end-testsuite", "thetestsuitename", "success", None),
], subunit_ops.calls)
self.assertEquals(0, exit_code)
@@ -153,10 +156,10 @@ expanded command: echo doing something
exit_code = run_testsuite_command("thetestsuitename", "exit 3", subunit_ops, outf=outf)
self.assertEquals([
("start-testsuite", "thetestsuitename"),
- ("progress", None, subunit.PROGRESS_PUSH),
+ ("progress", None, PROGRESS_PUSH),
("time", ),
("time", ),
- ("progress", None, subunit.PROGRESS_POP),
+ ("progress", None, PROGRESS_POP),
("end-testsuite", "thetestsuitename", "failure", "Exit code was 3"),
], subunit_ops.calls)
self.assertEquals(3, exit_code)
@@ -173,10 +176,10 @@ expanded command: exit 3
"thisisacommandthatdoesnotexist 2>/dev/null", subunit_ops, outf=outf)
self.assertEquals([
("start-testsuite", "thetestsuitename"),
- ("progress", None, subunit.PROGRESS_PUSH),
+ ("progress", None, PROGRESS_PUSH),
("time", ),
("time", ),
- ("progress", None, subunit.PROGRESS_POP),
+ ("progress", None, PROGRESS_POP),
("end-testsuite", "thetestsuitename", "failure", "Exit code was 127"),
], subunit_ops.calls)
self.assertEquals(127, exit_code)