summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Treinish <mtreinish@kortar.org>2021-06-15 13:22:54 -0400
committerGitHub <noreply@github.com>2021-06-15 13:22:54 -0400
commit04cd3c5664e136d63835dfee5104e84fbd7511cc (patch)
tree8ab833f7601891214dae472734a871654d5d36ba
parent0dd0bec5fa4b5a6ff32b76224cfe46e2e86ac482 (diff)
parent1c82fee86b1778335680416b9a0041a579d02714 (diff)
downloadsubunit-git-04cd3c5664e136d63835dfee5104e84fbd7511cc.tar.gz
Merge branch 'master' into fix-filter-entrypoints
-rw-r--r--.github/workflows/main.yml32
-rw-r--r--.travis.yml32
-rw-r--r--python/subunit/__init__.py8
-rw-r--r--python/subunit/_output.py29
-rw-r--r--python/subunit/tests/test_output_filter.py63
-rwxr-xr-xsetup.py1
6 files changed, 37 insertions, 128 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..bb8cbae
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,32 @@
+name: Tests
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+jobs:
+ tests:
+ name: tests-python${{ matrix.python-version }}-${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 'pypy3']
+ os: ["ubuntu-latest"]
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install Deps
+ run: sudo apt-get install check libcppunit-dev
+ - name: Install package
+ run: python -m pip install -U '.[test,docs]'
+ - name: Build
+ run: autoreconf -fi && ./configure && make
+ - name: Run make check
+ run: make check
+ - name: Run make distcheck
+ run: make distcheck
+ - name: Docs build
+ run: rst2html.py README.rst README.html
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 27593b3..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-sudo: false
-dist: focal
-addons:
- apt:
- packages:
- - check
- - libcppunit-dev
-language: python
-python:
- - "2.7"
- - "3.5"
- - "3.6"
- - "3.7"
- - "3.8"
- - "3.9"
- - "pypy2.7-7.3.1"
- - "pypy3.6-7.3.1"
-matrix:
- include:
- - dist: xenial
- python: pypy3.5-7.0.0
-install:
- - pip install -U pip
- - pip install -U wheel setuptools
- - pip install -U .[test,docs]
- - pip list
- - python --version
- - autoreconf -fi && ./configure && make
-script:
- - make check
- - make distcheck
- - rst2html.py README.rst README.html
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index 17a970a..becbdac 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -1033,7 +1033,7 @@ def TAP2SubUnit(tap, output_stream):
file_name=file_name, runnable=False)
for line in tap:
if state == BEFORE_PLAN:
- match = re.match("(\d+)\.\.(\d+)\s*(?:\#\s+(.*))?\n", line)
+ match = re.match(r"(\d+)\.\.(\d+)\s*(?:\#\s+(.*))?\n", line)
if match:
state = AFTER_PLAN
_, plan_stop, comment = match.groups()
@@ -1046,7 +1046,7 @@ def TAP2SubUnit(tap, output_stream):
file_name='tap comment')
continue
# not a plan line, or have seen one before
- match = re.match("(ok|not ok)(?:\s+(\d+)?)?(?:\s+([^#]*[^#\s]+)\s*)?(?:\s+#\s+(TODO|SKIP|skip|todo)(?:\s+(.*))?)?\n", line)
+ match = re.match(r"(ok|not ok)(?:\s+(\d+)?)?(?:\s+([^#]*[^#\s]+)\s*)?(?:\s+#\s+(TODO|SKIP|skip|todo)(?:\s+(.*))?)?\n", line)
if match:
# new test, emit current one.
_emit_test()
@@ -1074,7 +1074,7 @@ def TAP2SubUnit(tap, output_stream):
test_name = "test %d%s" % (plan_start, description)
plan_start += 1
continue
- match = re.match("Bail out\!(?:\s*(.*))?\n", line)
+ match = re.match(r"Bail out\!(?:\s*(.*))?\n", line)
if match:
reason, = match.groups()
if reason is None:
@@ -1086,7 +1086,7 @@ def TAP2SubUnit(tap, output_stream):
result = "fail"
state = SKIP_STREAM
continue
- match = re.match("\#.*\n", line)
+ match = re.match(r"\#.*\n", line)
if match:
log.append(line[:-1])
continue
diff --git a/python/subunit/_output.py b/python/subunit/_output.py
index c598c81..aa92646 100644
--- a/python/subunit/_output.py
+++ b/python/subunit/_output.py
@@ -22,8 +22,6 @@ from optparse import (
)
import sys
-from dateutil import parser as date_parser
-
from subunit import make_stream_binary
from subunit.iso8601 import UTC
from subunit.v2 import StreamResultToBytes
@@ -123,18 +121,6 @@ def parse_arguments(args=None, ParserClass=OptionParser):
dest="tags",
default=[]
)
- parser.add_option(
- "--start-time",
- help="Specify a time for the test to start",
- dest="start_time",
- default=None
- )
- parser.add_option(
- "--stop-time",
- help="Specify a time for the test to finish executing",
- dest="stop_time",
- default=None
- )
(options, args) = parser.parse_args(args)
if options.mimetype and not options.attach_file:
@@ -166,14 +152,6 @@ def set_status_cb(option, opt_str, value, parser, status_name):
def generate_stream_results(args, output_writer):
- if args.start_time:
- start_time = date_parser.parse(args.start_time)
- else:
- start_time = None
- if args.stop_time:
- stop_time = date_parser.parse(args.stop_time)
- else:
- stop_time = None
output_writer.startTestRun()
if args.attach_file:
@@ -192,7 +170,6 @@ def generate_stream_results(args, output_writer):
write_status = partial(write_status, mime_type=args.mimetype)
if args.tags:
write_status = partial(write_status, test_tags=set(args.tags))
- timestamp = start_time or create_timestamp()
write_status = partial(write_status, timestamp=create_timestamp())
if args.action not in _FINAL_ACTIONS:
write_status = partial(write_status, test_status=args.action)
@@ -215,11 +192,7 @@ def generate_stream_results(args, output_writer):
if is_last_packet:
if args.action in _FINAL_ACTIONS:
- if stop_time:
- write_status = partial(write_status, test_status=args.action,
- timestamp=stop_time)
- else:
- write_status = partial(write_status, test_status=args.action)
+ write_status = partial(write_status, test_status=args.action)
write_status()
diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py
index 587fd06..0f61ac5 100644
--- a/python/subunit/tests/test_output_filter.py
+++ b/python/subunit/tests/test_output_filter.py
@@ -472,69 +472,6 @@ class StatusStreamResultTests(TestCase):
])
)
-class TimeStampTests(TestCase):
- scenarios = [
- (s, dict(status=s, option='--' + s)) for s in _FINAL_ACTIONS
- ]
-
- _dummy_timestamp = datetime.datetime(1914, 6, 28, 10, 45, 2, 0, UTC)
-
- def setUp(self):
- super(TimeStampTests, self).setUp()
- self.patch(_o, 'create_timestamp', lambda: self._dummy_timestamp)
- self.test_id = self.getUniqueString()
-
- def test_no_timestamps(self):
- result = get_result_for([self.option, self.test_id, f.name])
- self.assertThat(
- result._events,
- MatchesListwise([
- MatchesStatusCall(call='startTestRun'),
- MatchesStatusCall(test_id=self.test_id, timestamp=self._dummy_timestamp),
- MatchesStatusCall(test_id=self.test_id, timestamp=None),
- MatchesStatusCall(call='stopTestRun'),
- ]))
-
- def test_only_start_timestamp(self):
- timestamp = datetime.datetime.utcnow()
- result = get_result_for([self.option, self.test_id, f.name,
- '--start-time', timestamp.isoformat()])
- self.assertThat(
- result._events,
- MatchesListwise([
- MatchesStatusCall(call='startTestRun'),
- MatchesStatusCall(test_id=self.test_id, timestamp=timestamp),
- MatchesStatusCall(test_id=self.test_id, timestamp=None),
- MatchesStatusCall(call='stopTestRun'),
- ]))
-
- def test_only_stop_timestamp(self):
- timestamp = datetime.datetime.utcnow()
- result = get_result_for([self.option, self.test_id, f.name,
- '--stop-time', timestamp.isoformat()])
- self.assertThat(
- result._events,
- MatchesListwise([
- MatchesStatusCall(call='startTestRun'),
- MatchesStatusCall(test_id=self.test_id, timestamp=self._dummy_timestamp),
- MatchesStatusCall(test_id=self.test_id, timestamp=timestamp),
- MatchesStatusCall(call='stopTestRun'),
- ]))
-
- def test_start_and_stop_timestamp(self):
- timestamp_start = datetime.datetime.utcnow()
- timestamp_stop = timestamp_start + datetime.timedelta(minutes=5)
- result = get_result_for([self.option, self.test_id, f.name,
- '--start-time', timestamp_start.isoformat(),
- '--stop-time', timestamp_stop.isoformat()])
- self.assertThat(
- result._events,
- MatchesListwise([
- MatchesStatusCall(call='startTestRun'),
- MatchesStatusCall(test_id=self.test_id, timestamp=timestamp_start),
- MatchesStatusCall(test_id=self.test_id, timestamp=timestamp_stop),
- MatchesStatusCall(call='stopTestRun'),
- ]))
class FileDataTests(TestCase):
diff --git a/setup.py b/setup.py
index 81aef9e..1f9ee67 100755
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python
import os.path
-
from setuptools import setup