@@ -357,7 +357,7 @@ <h1 class="title">Nose2pytest version 1.0.4 documentation</h1>
357
357
</ div >
358
358
< div class ="section " id ="overview ">
359
359
< h1 > < a class ="toc-backref " href ="#id1 "> Overview</ a > </ h1 >
360
- < p > This package provides a Python script and py.test plugin to help convert Nose-based tests into py.test -based
360
+ < p > This package provides a Python script and pytest plugin to help convert Nose-based tests into pytest -based
361
361
tests. Specifically, the script transforms < tt class ="docutils literal "> nose.tools.assert_*</ tt > function calls into raw assert statements,
362
362
while preserving format of original arguments as much as possible. For example, the script</ p >
363
363
< pre class ="literal-block ">
@@ -371,7 +371,7 @@ <h1><a class="toc-backref" href="#id1">Overview</a></h1>
371
371
</ pre >
372
372
< p > A small subset of < tt class ="docutils literal "> nose.tools.assert_*</ tt > function calls are not
373
373
transformed because there is no raw assert statement equivalent, or the equivalent would be hard to
374
- maintain. They are provided as functions in the pytest namespace via py.test 's plugin system.</ p >
374
+ maintain. They are provided as functions in the pytest namespace via pytest 's plugin system.</ p >
375
375
</ div >
376
376
< div class ="section " id ="installation ">
377
377
< h1 > < a class ="toc-backref " href ="#id2 "> Installation</ a > </ h1 >
@@ -399,29 +399,29 @@ <h1><a class="toc-backref" href="#id4">Motivation</a></h1>
399
399
are not as convenient to use as raw assertions, since you have to decide before hand what type of assertion you
400
400
are going to write: an identity comparison to None, a truth check, a falseness check, an identity comparison to another
401
401
object, etc. Just being able to write a raw assertion, and still get good diagnostics on failure as done by
402
- py.test , is really nice. This is a main reason for using py.test for me. Another reason is the design of fixtures
403
- in py.test .</ p >
404
- < p > Switching an existing test suite from Nose to py.test is feasible even without nose2pytest, as it requires
402
+ pytest , is really nice. This is a main reason for using pytest for me. Another reason is the design of fixtures
403
+ in pytest .</ p >
404
+ < p > Switching an existing test suite from Nose to pytest is feasible even without nose2pytest, as it requires
405
405
relatively little work: < em > relatively</ em > as in, you will probably only need a few modifications, all achievable
406
406
manually, to get the same test coverage and results. A few gotchas:</ p >
407
407
< ul class ="simple ">
408
408
< li > test classes that have < tt class ="docutils literal "> __init__</ tt > will be ignored, those will have to be moved (usually, into class's
409
409
< tt class ="docutils literal "> setup_class()</ tt > )</ li >
410
- < li > the < tt class ="docutils literal "> setup.cfg</ tt > may have to be edited since test discovery rules are slightly more strict with py.test </ li >
410
+ < li > the < tt class ="docutils literal "> setup.cfg</ tt > may have to be edited since test discovery rules are slightly more strict with pytest </ li >
411
411
< li > the order of tests may be different, but in general that should not matter</ li >
412
412
< li > all test modules are imported up-front, so some test modules may need adjustment such as moving some
413
413
code from the top of the test module into its < tt class ="docutils literal "> setup_module()</ tt > </ li >
414
414
</ ul >
415
415
< p > Once the above has been done to an existing code base, you don't really have to do anything else. However, your test
416
416
suite now has an additional third-party test dependency (Nose), just because of those < tt class ="docutils literal "> assert_*</ tt > functions used all
417
417
over the place. Moreover, there is no longer one obvious way to do things in your test suite: existing test code
418
- uses < tt class ="docutils literal "> nose.tools.assert_*</ tt > functions, yet with py.test you can use raw assertions. If you add tests, which of
418
+ uses < tt class ="docutils literal "> nose.tools.assert_*</ tt > functions, yet with pytest you can use raw assertions. If you add tests, which of
419
419
these two approaches should a developer use? If you modify existing tests, should new assertions use raw assert?
420
420
Should the remaining test method, test class, or test module be updated? A test module can contain hundreds of
421
421
calls to < tt class ="docutils literal "> nose.tools.assert_*</ tt > functions, is a developer to manually go through each one to convert it? Painful and
422
422
error prone, in general not feasible to do manually.</ p >
423
- < p > This is why I developed nose2pytest: I wanted to migrate my pypubsub project's test suite from Nose to py.test ,
424
- but also have only py.test as a dependency, and have one obvious way to write assertions in the test suite.</ p >
423
+ < p > This is why I developed nose2pytest: I wanted to migrate my pypubsub project's test suite from Nose to pytest ,
424
+ but also have only pytest as a dependency, and have one obvious way to write assertions in the test suite.</ p >
425
425
</ div >
426
426
< div class ="section " id ="requirements ">
427
427
< h1 > < a class ="toc-backref " href ="#id5 "> Requirements</ a > </ h1 >
@@ -433,7 +433,7 @@ <h1><a class="toc-backref" href="#id5">Requirements</a></h1>
433
433
Nose 1.3.7 on Windows 7 Pro 64. If you have successfully used nose2pytest with other combinations, please
434
434
kindly let me know (via github).</ p >
435
435
< p > The pytest package namespace will be extended with < tt class ="docutils literal "> assert_</ tt > functions that are not converted by the script
436
- only if, err, you have py.test installed!</ p >
436
+ only if, err, you have pytest installed!</ p >
437
437
</ div >
438
438
< div class ="section " id ="status ">
439
439
< h1 > < a class ="toc-backref " href ="#id6 "> Status</ a > </ h1 >
@@ -583,7 +583,7 @@ <h1><a class="toc-backref" href="#id6">Status</a></h1>
583
583
</ ul >
584
584
< p > The nose2pytest distribution contains a module, < tt class ="docutils literal "> assert_tools.py</ tt > which defines these utility functions to
585
585
contain the equivalent raw assert statement. Copy the module into your test folder or into the pytest package
586
- and change your test code's < tt class ="docutils literal "> from nose.tools import ...</ tt > statements accordingly. Py.test introspection will
586
+ and change your test code's < tt class ="docutils literal "> from nose.tools import ...</ tt > statements accordingly. pytest introspection will
587
587
provide error information on assertion failure.</ p >
588
588
</ li >
589
589
< li > < p class ="first "> Some Nose functions don't have a one-line assert statement equivalent, they have to remain utility functions:</ p >
0 commit comments