Skip to content

Commit 35efcfc

Browse files
authored
run doctests (via #93)
1 parent 5a31fe5 commit 35efcfc

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

allure-python-commons-test/src/container.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ def describe_mismatch(self, item, mismatch_descaription):
2828

2929
def has_container(report, *matchers):
3030
"""
31+
>>> from hamcrest import assert_that
32+
33+
>>> from allure_commons_test.report import has_test_case
34+
3135
>>> class Report(object):
3236
... test_cases = [
3337
... {
@@ -60,7 +64,7 @@ def has_container(report, *matchers):
6064
... has_before('before_fixture')
6165
... )
6266
... )
63-
... )
67+
... ) # doctest: +ELLIPSIS
6468
Traceback (most recent call last):
6569
...
6670
AssertionError: ...
@@ -104,6 +108,8 @@ def describe_to(self, description):
104108

105109
def has_same_container(*args):
106110
"""
111+
>>> from hamcrest import assert_that
112+
107113
>>> class Report(object):
108114
... test_cases = [
109115
... {
@@ -134,7 +140,7 @@ def has_same_container(*args):
134140
135141
>>> assert_that(Report,
136142
... has_same_container('second_test_case', 'third_test_case')
137-
... )
143+
... ) # doctest: +ELLIPSIS
138144
Traceback (most recent call last):
139145
...
140146
AssertionError: ...

allure-python-commons-test/src/label.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
"""
2-
No milk today my love has gone away;)
3-
"""
4-
51
from hamcrest import all_of
62
from hamcrest import has_entry, has_item
73

@@ -33,4 +29,4 @@ def has_story(story):
3329

3430

3531
def has_tag(tag):
36-
return has_label('tag', tag)
32+
return has_label('tag', tag)

allure-python-commons-test/src/report.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""
2+
>>> from hamcrest import assert_that
3+
24
>>> class Report(object):
35
... def __init__(self):
46
... self.test_cases = [
@@ -34,7 +36,7 @@
3436
3537
>>> assert_that(Report(),
3638
... has_test_case('wrong_test_case_name')
37-
... )
39+
... ) # doctest: +ELLIPSIS
3840
Traceback (most recent call last):
3941
...
4042
AssertionError: ...
@@ -54,7 +56,7 @@
5456
... has_test_case('Class#test[param]',
5557
... has_entry('id', '2')
5658
... )
57-
... )
59+
... ) # doctest: +ELLIPSIS
5860
Traceback (most recent call last):
5961
...
6062
AssertionError: ...

allure-python-commons-test/src/result.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@
3333
... }
3434
... }
3535
36-
HAS STEP +
36+
3737
>>> assert_that(testcases['ideal_case'], has_step('step_one'))
3838
3939
40-
HAS STEP +-
4140
>>> assert_that(testcases['ideal_case'],
42-
... has_step('ideal_case'),
43-
... is_not(has_step('step_one')
44-
... ))
41+
... has_step('ideal_case'),
42+
... is_not(has_step('step_one'))
43+
... ) # doctest: +ELLIPSIS
4544
Traceback (most recent call last):
4645
...
4746
AssertionError: ...
@@ -50,8 +49,9 @@
5049
<BLANKLINE>
5150
5251
53-
HAS STEP -
54-
>>> assert_that(testcases['ideal_case'], has_step('wrong_steop_name'))
52+
>>> assert_that(testcases['ideal_case'],
53+
... has_step('wrong_step_name')
54+
... ) # doctest: +ELLIPSIS
5555
Traceback (most recent call last):
5656
...
5757
AssertionError: ...

allure-python-commons-test/tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ passenv =
99

1010
commands=
1111
python setup.py develop
12+
python -m doctest -v ./src/container.py
13+
python -m doctest -v ./src/report.py
14+
python -m doctest -v ./src/label.py
15+
python -m doctest -v ./src/result.py

0 commit comments

Comments
 (0)