Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:

- name: Run tests
run: |
python -W once -m testtools.run testtools.tests.test_suite
python -W once -m testtools.run tests.test_suite

docs:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .testr.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[DEFAULT]
test_command=${PYTHON:-python3} -m subunit.run $LISTOPT $IDOPTION testtools.tests.test_suite
test_command=${PYTHON:-python3} -m subunit.run $LISTOPT $IDOPTION tests.test_suite
test_id_option=--load-list $IDFILE
test_list_option=--list
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PYTHON=python3
SOURCES=$(shell find testtools -name "*.py")

check:
PYTHONPATH=$(PWD) $(PYTHON) -m testtools.run testtools.tests.test_suite
PYTHONPATH=$(PWD) $(PYTHON) -m testtools.run tests.test_suite

TAGS: ${SOURCES}
ctags -e -R testtools/
Expand Down
2 changes: 1 addition & 1 deletion doc/hacking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Users of testtools should never import a submodule in order to use a stable
API. Unstable APIs like ``testtools.matchers`` and
``testtools.deferredruntest`` should be exported as submodules.

Tests belong in ``testtools/tests/``.
Tests belong in ``tests/``.


Committing to trunk
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ignore_missing_imports = true
[[tool.mypy.overrides]]
module = [
# FIXME(stephenfin): We would like to remove all modules from this list
# except testtools.tests (we're not sadists)
# except tests (we're not sadists)
"testtools.assertions",
"testtools.compat",
"testtools.content",
Expand All @@ -91,7 +91,7 @@ module = [
"testtools.testresult.*",
"testtools.testsuite",
"testtools.twistedsupport.*",
"testtools.tests.*",
"tests.*",
]
disallow_untyped_calls = false
disallow_untyped_defs = false
Expand Down
2 changes: 1 addition & 1 deletion scripts/all-pythons
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ROOT = os.path.dirname(os.path.dirname(__file__))

def run_for_python(version, result, tests):
if not tests:
tests = ['testtools.tests.test_suite']
tests = ['tests.test_suite']
# XXX: This could probably be broken up and put into subunit.
python = 'python%s' % (version,)
# XXX: Correct API, but subunit doesn't support it. :(
Expand Down
2 changes: 1 addition & 1 deletion testtools/tests/__init__.py → tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def test_suite():
from testtools.tests import (
from . import (
matchers,
test_assert_that,
test_compat,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def test_suite():
from testtools.tests.matchers import (
from ..matchers import (
test_basic,
test_const,
test_datastructures,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
_BinaryMismatch,
_NotNearlyEqual,
)
from testtools.tests.helpers import FullStackRunTest
from testtools.tests.matchers.helpers import TestMatchersInterface

from ..helpers import FullStackRunTest
from ..matchers.helpers import TestMatchersInterface


class Test_BinaryMismatch(TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

from testtools import TestCase
from testtools.matchers import Always, Never
from testtools.tests.matchers.helpers import TestMatchersInterface

from ..matchers.helpers import TestMatchersInterface


class TestAlwaysInterface(TestMatchersInterface, TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
MatchesSetwise,
MatchesStructure,
)
from testtools.tests.helpers import FullStackRunTest
from testtools.tests.matchers.helpers import TestMatchersInterface

from ..helpers import FullStackRunTest
from ..matchers.helpers import TestMatchersInterface


def run_doctest(obj, name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
MatchesDict,
_SubDictOf,
)
from testtools.tests.matchers.helpers import TestMatchersInterface

from ..matchers.helpers import TestMatchersInterface


class TestMatchesAllDictInterface(TestCase, TestMatchersInterface):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
_b,
)
from testtools.matchers._doctest import DocTestMatches
from testtools.tests.helpers import FullStackRunTest
from testtools.tests.matchers.helpers import TestMatchersInterface

from ..helpers import FullStackRunTest
from ..matchers.helpers import TestMatchersInterface


class TestDocTestMatchesInterface(TestCase, TestMatchersInterface):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
Raises,
raises,
)
from testtools.tests.helpers import FullStackRunTest
from testtools.tests.matchers.helpers import TestMatchersInterface

from ..helpers import FullStackRunTest
from ..matchers.helpers import TestMatchersInterface


def make_error(type, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
MatchesPredicateWithParams,
Not,
)
from testtools.tests.helpers import FullStackRunTest
from testtools.tests.matchers.helpers import TestMatchersInterface

from ..helpers import FullStackRunTest
from ..matchers.helpers import TestMatchersInterface


class TestAllMatch(TestCase, TestMatchersInterface):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
MismatchDecorator,
MismatchError,
)
from testtools.tests.helpers import FullStackRunTest

from ..helpers import FullStackRunTest

# Silence pyflakes.
Matcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
MatchesStructure,
)
from testtools.matchers._warnings import IsDeprecated, WarningMessage, Warnings
from testtools.tests.helpers import FullStackRunTest
from testtools.tests.matchers.helpers import TestMatchersInterface

from ..helpers import FullStackRunTest
from ..matchers.helpers import TestMatchersInterface


def make_warning(warning_type, message):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion testtools/tests/test_content.py → tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
Raises,
raises,
)
from testtools.tests.helpers import an_exc_info

from .helpers import an_exc_info

raises_value_error = Raises(MatchesException(ValueError))

Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion testtools/tests/test_helpers.py → tests/test_helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright (c) 2010-2012 testtools developers. See LICENSE for details.

from testtools import TestCase
from testtools.tests.helpers import (

from .helpers import (
FullStackRunTest,
hide_testtools_stack,
is_stack_hidden,
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion testtools/tests/test_runtest.py → tests/test_runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
)
from testtools.matchers import HasLength, Is, MatchesException, Raises
from testtools.testresult.doubles import ExtendedTestResult
from testtools.tests.helpers import FullStackRunTest

from .helpers import FullStackRunTest


class TestRunTest(TestCase):
Expand Down
File renamed without changes.
23 changes: 10 additions & 13 deletions testtools/tests/test_testcase.py → tests/test_testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@
ExtendedTestResult,
Python3TestResult,
)
from testtools.tests.helpers import (

from .helpers import (
AsText,
FullStackRunTest,
LoggingResult,
MatchesEvents,
an_exc_info,
raise_,
)
from testtools.tests.samplecases import (
from .samplecases import (
deterministic_sample_cases_scenarios,
make_case_for_behavior_scenario,
make_test_case,
Expand Down Expand Up @@ -1602,7 +1603,7 @@ def test_method(self):
self.assertThat(
result.errors[0][1],
DocTestMatches(
"...ValueError...File...testtools/tests/test_testcase.py...", ELLIPSIS
"...ValueError...File...tests/test_testcase.py...", ELLIPSIS
),
)

Expand All @@ -1620,7 +1621,7 @@ def test_method(self):
self.assertThat(
result.errors[0][1],
DocTestMatches(
"...ValueError...File...testtools/tests/test_testcase.py...", ELLIPSIS
"...ValueError...File...tests/test_testcase.py...", ELLIPSIS
),
)

Expand All @@ -1635,7 +1636,7 @@ def test_method(self):
self.assertThat(
result.errors[0][1],
DocTestMatches(
"...ValueError...File...testtools/tests/test_testcase.py...", ELLIPSIS
"...ValueError...File...tests/test_testcase.py...", ELLIPSIS
),
)

Expand All @@ -1653,7 +1654,7 @@ def tearDown(self):
self.assertThat(
result.errors[0][1],
DocTestMatches(
"...ValueError...File...testtools/tests/test_testcase.py...", ELLIPSIS
"...ValueError...File...tests/test_testcase.py...", ELLIPSIS
),
)

Expand Down Expand Up @@ -2219,20 +2220,16 @@ class TestAttributes(TestCase):
def test_simple_attr(self):
# Adding an attr to a test changes its id().
case = Attributes("simple")
self.assertEqual(
"testtools.tests.test_testcase.Attributes.simple[foo]", case.id()
)
self.assertEqual("tests.test_testcase.Attributes.simple[foo]", case.id())

def test_multiple_attributes(self):
case = Attributes("many")
self.assertEqual(
"testtools.tests.test_testcase.Attributes.many[bar,foo,quux]", case.id()
)
self.assertEqual("tests.test_testcase.Attributes.many[bar,foo,quux]", case.id())

def test_multiple_attr_decorators(self):
case = Attributes("decorated")
self.assertEqual(
"testtools.tests.test_testcase.Attributes.decorated[bar,foo,quux]",
"tests.test_testcase.Attributes.decorated[bar,foo,quux]",
case.id(),
)

Expand Down
23 changes: 12 additions & 11 deletions testtools/tests/test_testresult.py → tests/test_testresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
_merge_tags,
utc,
)
from testtools.tests.helpers import (

from .helpers import (
FullStackRunTest,
LoggingResult,
an_exc_info,
Expand Down Expand Up @@ -1219,7 +1220,7 @@ def test_explicit_time(self):
("startTestRun",),
(
"status",
"testtools.tests.test_testresult.TestExtendedToStreamDecorator.test_explicit_time",
"tests.test_testresult.TestExtendedToStreamDecorator.test_explicit_time",
"inprogress",
None,
True,
Expand All @@ -1232,7 +1233,7 @@ def test_explicit_time(self):
),
(
"status",
"testtools.tests.test_testresult.TestExtendedToStreamDecorator.test_explicit_time",
"tests.test_testresult.TestExtendedToStreamDecorator.test_explicit_time",
"success",
set(),
True,
Expand Down Expand Up @@ -1271,7 +1272,7 @@ def test_empty_detail_status_correct(self):
("startTestRun",),
(
"status",
"testtools.tests.test_testresult.TestExtendedToStreamDecorator.test_empty_detail_status_correct",
"tests.test_testresult.TestExtendedToStreamDecorator.test_empty_detail_status_correct",
"inprogress",
None,
True,
Expand All @@ -1284,7 +1285,7 @@ def test_empty_detail_status_correct(self):
),
(
"status",
"testtools.tests.test_testresult.TestExtendedToStreamDecorator.test_empty_detail_status_correct",
"tests.test_testresult.TestExtendedToStreamDecorator.test_empty_detail_status_correct",
None,
None,
True,
Expand All @@ -1297,7 +1298,7 @@ def test_empty_detail_status_correct(self):
),
(
"status",
"testtools.tests.test_testresult.TestExtendedToStreamDecorator.test_empty_detail_status_correct",
"tests.test_testresult.TestExtendedToStreamDecorator.test_empty_detail_status_correct",
"fail",
set(),
True,
Expand Down Expand Up @@ -1528,7 +1529,7 @@ def _report_files(self, result):
file_name="traceback",
file_bytes=_b(
"""Traceback (most recent call last):
File "testtools/tests/test_testresult.py", line 607, in test_stopTestRun
File "tests/test_testresult.py", line 607, in test_stopTestRun
AllMatch(Equals([('startTestRun',), ('stopTestRun',)])))
testtools.matchers._impl.MismatchError: Differences: [
[('startTestRun',), ('stopTestRun',)] != []
Expand All @@ -1545,7 +1546,7 @@ def _report_files(self, result):
"""some log.txt: {{{1234 log message}}}

Traceback (most recent call last):
File "testtools/tests/test_testresult.py", line 607, in test_stopTestRun
File "tests/test_testresult.py", line 607, in test_stopTestRun
AllMatch(Equals([('startTestRun',), ('stopTestRun',)])))
testtools.matchers._impl.MismatchError: Differences: [
[('startTestRun',), ('stopTestRun',)] != []
Expand Down Expand Up @@ -2056,21 +2057,21 @@ def run_tests():
self.getvalue(),
DocTestMatches(
"""...======================================================================
ERROR: testtools.tests.test_testresult.Test.error
ERROR: tests.test_testresult.Test.error
----------------------------------------------------------------------
Traceback (most recent call last):
File "...testtools...tests...test_testresult.py", line ..., in error
1 / 0
ZeroDivisionError:... divi... by zero...
======================================================================
FAIL: testtools.tests.test_testresult.Test.failed
FAIL: tests.test_testresult.Test.failed
----------------------------------------------------------------------
Traceback (most recent call last):
File "...testtools...tests...test_testresult.py", line ..., in failed
self.fail("yo!")
AssertionError: yo!
======================================================================
UNEXPECTED SUCCESS: testtools.tests.test_testresult.Test.succeeded
UNEXPECTED SUCCESS: tests.test_testresult.Test.succeeded
----------------------------------------------------------------------
...""",
doctest.ELLIPSIS | doctest.REPORT_NDIFF,
Expand Down
Loading