Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit383d1ee

Browse files
committed
Move to py.test!
Also enforce ordering of tests and test files, given nodeids for generatorsdepend upon iteration number, and pytest-expect relies on them.
1 parent71ac558 commit383d1ee

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

‎.travis.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ install:
3838
-bash requirements-install.sh
3939

4040
script:
41-
-nosetests
41+
-py.test
4242
-bash flake8-run.sh
4343

4444
after_script:

‎README.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ Please report any bugs on the `issue tracker
132132
Tests
133133
-----
134134

135-
Unit tests require the ``nose`` and ``mock`` libraries and can be run
136-
using the ``nosetests`` command in the root directory; ``ordereddict``
137-
is required under Python 2.6. All should pass.
135+
Unit tests require the ``pytest`` and ``mock`` libraries and can be
136+
runusing the ``py.test`` command in the root directory;
137+
``ordereddict``is required under Python 2.6. All should pass.
138138

139139
Test data are contained in a separate `html5lib-tests
140140
<https://github.com/html5lib/html5lib-tests>`_ repository and included

‎html5lib/tests/support.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343

4444
defget_data_files(subdirectory,files='*.dat'):
45-
returnglob.glob(os.path.join(test_dir,subdirectory,files))
45+
returnsorted(glob.glob(os.path.join(test_dir,subdirectory,files)))
4646

4747

4848
classDefaultDict(dict):

‎html5lib/tests/test_parser.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_parser():
9090
iferrors:
9191
errors=errors.split("\n")
9292

93-
fortreeName,treeClsintreeTypes.items():
93+
fortreeName,treeClsinsorted(treeTypes.items()):
9494
fornamespaceHTMLElementsin (True,False):
9595
yield (runParserTest,innerHTML,input,expected,errors,treeCls,
9696
namespaceHTMLElements)

‎html5lib/tests/test_treewalkers.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_all_tokens(self):
8787
{'data': {},'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'body'},
8888
{'data': {},'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'html'}
8989
]
90-
fortreeName,treeClsintreeTypes.items():
90+
fortreeName,treeClsinsorted(treeTypes.items()):
9191
p=html5parser.HTMLParser(tree=treeCls["builder"])
9292
document=p.parse("<html><head></head><body>a<div>b</div>c</body></html>")
9393
document=treeCls.get("adapter",lambdax:x)(document)
@@ -130,7 +130,7 @@ def runTreewalkerTest(innerHTML, input, expected, errors, treeClass):
130130
deftest_treewalker():
131131
sys.stdout.write('Testing tree walkers '+" ".join(list(treeTypes.keys()))+"\n")
132132

133-
fortreeName,treeClsintreeTypes.items():
133+
fortreeName,treeClsinsorted(treeTypes.items()):
134134
files=get_data_files('tree-construction')
135135
forfilenameinfiles:
136136
testName=os.path.basename(filename).replace(".dat","")
@@ -194,6 +194,6 @@ def test_treewalker_six_mix():
194194
'<link>\n href="http://example.com/cow"\n rel="alternate"\n "Example"')
195195
]
196196

197-
fortreeintreeTypes.items():
197+
fortreeinsorted(treeTypes.items()):
198198
forintext,attrs,expectedinsm_tests:
199199
yieldrunTreewalkerEditTest,intext,expected,attrs,tree

‎pytest.ini‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
addopts = -rXw -p no:doctest

‎requirements-test.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-r requirements.txt
22

33
flake8
4-
nose
4+
pytest
5+
pytest-expect>=1.0,<2.0
56
mock
67
ordereddict ; python_version < '2.7'

‎tox.ini‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ envlist = {py26,py27,py32,py33,py34,py35,pypy,pypy3}-{base,optional}
44
[testenv]
55
deps =
66
flake8
7-
nose
7+
pytest
8+
pytest-expect>=1.0,<2.0
89
mock
910
py26-base: ordereddict
1011
optional: -r{toxinidir}/requirements-optional.txt
1112

1213
commands =
13-
{envbindir}/nosetests -q
14+
{envbindir}/py.test
1415
{toxinidir}/flake8-run.sh

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp