Skip to content

Commit 758b27a

Browse files
authored
Merge pull request #18 from hugovk/replace-travis-with-gha
2 parents 8e1f0e9 + b35d7b6 commit 758b27a

File tree

7 files changed

+80
-42
lines changed

7 files changed

+80
-42
lines changed

.github/workflows/test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Test
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
env:
6+
FORCE_COLOR: 1
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["3.5", "3.6", "3.7.7", "3.8"]
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Get pip cache dir
26+
id: pip-cache
27+
run: |
28+
echo "::set-output name=dir::$(pip cache dir)"
29+
30+
- name: Cache
31+
uses: actions/cache@v2
32+
with:
33+
path: ${{ steps.pip-cache.outputs.dir }}
34+
key:
35+
${{ matrix.os }}-${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}
36+
restore-keys: |
37+
${{ matrix.os }}-${{ matrix.python-version }}-v1-
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install -U pip
42+
python -m pip install -U wheel
43+
python -m pip install -U tox
44+
45+
- name: Test
46+
run: |
47+
tox -e py

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ <h1 class="title">Nose2pytest version 1.0.4 documentation</h1>
357357
</div>
358358
<div class="section" id="overview">
359359
<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
361361
tests. Specifically, the script transforms <tt class="docutils literal">nose.tools.assert_*</tt> function calls into raw assert statements,
362362
while preserving format of original arguments as much as possible. For example, the script</p>
363363
<pre class="literal-block">
@@ -371,7 +371,7 @@ <h1><a class="toc-backref" href="#id1">Overview</a></h1>
371371
</pre>
372372
<p>A small subset of <tt class="docutils literal">nose.tools.assert_*</tt> function calls are not
373373
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>
375375
</div>
376376
<div class="section" id="installation">
377377
<h1><a class="toc-backref" href="#id2">Installation</a></h1>
@@ -399,29 +399,29 @@ <h1><a class="toc-backref" href="#id4">Motivation</a></h1>
399399
are not as convenient to use as raw assertions, since you have to decide before hand what type of assertion you
400400
are going to write: an identity comparison to None, a truth check, a falseness check, an identity comparison to another
401401
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
405405
relatively little work: <em>relatively</em> as in, you will probably only need a few modifications, all achievable
406406
manually, to get the same test coverage and results. A few gotchas:</p>
407407
<ul class="simple">
408408
<li>test classes that have <tt class="docutils literal">__init__</tt> will be ignored, those will have to be moved (usually, into class's
409409
<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>
411411
<li>the order of tests may be different, but in general that should not matter</li>
412412
<li>all test modules are imported up-front, so some test modules may need adjustment such as moving some
413413
code from the top of the test module into its <tt class="docutils literal">setup_module()</tt></li>
414414
</ul>
415415
<p>Once the above has been done to an existing code base, you don't really have to do anything else. However, your test
416416
suite now has an additional third-party test dependency (Nose), just because of those <tt class="docutils literal">assert_*</tt> functions used all
417417
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
419419
these two approaches should a developer use? If you modify existing tests, should new assertions use raw assert?
420420
Should the remaining test method, test class, or test module be updated? A test module can contain hundreds of
421421
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
422422
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>
425425
</div>
426426
<div class="section" id="requirements">
427427
<h1><a class="toc-backref" href="#id5">Requirements</a></h1>
@@ -433,7 +433,7 @@ <h1><a class="toc-backref" href="#id5">Requirements</a></h1>
433433
Nose 1.3.7 on Windows 7 Pro 64. If you have successfully used nose2pytest with other combinations, please
434434
kindly let me know (via github).</p>
435435
<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>
437437
</div>
438438
<div class="section" id="status">
439439
<h1><a class="toc-backref" href="#id6">Status</a></h1>
@@ -583,7 +583,7 @@ <h1><a class="toc-backref" href="#id6">Status</a></h1>
583583
</ul>
584584
<p>The nose2pytest distribution contains a module, <tt class="docutils literal">assert_tools.py</tt> which defines these utility functions to
585585
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
587587
provide error information on assertion failure.</p>
588588
</li>
589589
<li><p class="first">Some Nose functions don't have a one-line assert statement equivalent, they have to remain utility functions:</p>

README.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. image:: https://badge.fury.io/py/nose2pytest.svg
22
:target: https://badge.fury.io/py/nose2pytest
3-
.. image:: https://img.shields.io/travis/pytest-dev/nose2pytest.svg
4-
:target: https://img.shields.io/travis/pytest-dev/nose2pytest
3+
.. image:: https://github.com/pytest-dev/nose2pytest/workflows/Test/badge.svg
4+
:target: https://github.com/pytest-dev/nose2pytest/actions
55

66

77
.. contents::
@@ -10,7 +10,7 @@
1010
Overview
1111
------------
1212

13-
This package provides a Python script and py.test plugin to help convert Nose-based tests into py.test-based
13+
This package provides a Python script and pytest plugin to help convert Nose-based tests into pytest-based
1414
tests. Specifically, the script transforms ``nose.tools.assert_*`` function calls into raw assert statements,
1515
while preserving format of original arguments as much as possible. For example, the script:
1616

@@ -28,7 +28,7 @@ gets converted to:
2828
2929
A small subset of ``nose.tools.assert_*`` function calls are not
3030
transformed because there is no raw assert statement equivalent, or the equivalent would be hard to
31-
maintain. They are provided as functions in the pytest namespace via py.test's plugin system.
31+
maintain. They are provided as functions in the pytest namespace via pytest's plugin system.
3232

3333

3434
Installation
@@ -62,31 +62,31 @@ ought to use the ``assert_*()`` functions from ``nose.tools``. Although they pro
6262
are not as convenient to use as raw assertions, since you have to decide before hand what type of assertion you
6363
are going to write: an identity comparison to None, a truth check, a falseness check, an identity comparison to another
6464
object, etc. Just being able to write a raw assertion, and still get good diagnostics on failure as done by
65-
py.test, is really nice. This is a main reason for using py.test for me. Another reason is the design of fixtures
66-
in py.test.
65+
pytest, is really nice. This is a main reason for using pytest for me. Another reason is the design of fixtures
66+
in pytest.
6767

68-
Switching an existing test suite from Nose to py.test is feasible even without nose2pytest, as it requires
68+
Switching an existing test suite from Nose to pytest is feasible even without nose2pytest, as it requires
6969
relatively little work: *relatively* as in, you will probably only need a few modifications, all achievable
7070
manually, to get the same test coverage and results. A few gotchas:
7171

7272
- test classes that have ``__init__`` will be ignored, those will have to be moved (usually, into class's
7373
``setup_class()``)
74-
- the ``setup.cfg`` may have to be edited since test discovery rules are slightly more strict with py.test
74+
- the ``setup.cfg`` may have to be edited since test discovery rules are slightly more strict with pytest
7575
- the order of tests may be different, but in general that should not matter
7676
- all test modules are imported up-front, so some test modules may need adjustment such as moving some
7777
code from the top of the test module into its ``setup_module()``
7878

7979
Once the above has been done to an existing code base, you don't really have to do anything else. However, your test
8080
suite now has an additional third-party test dependency (Nose), just because of those ``assert_*`` functions used all
8181
over the place. Moreover, there is no longer one obvious way to do things in your test suite: existing test code
82-
uses ``nose.tools.assert_*`` functions, yet with py.test you can use raw assertions. If you add tests, which of
82+
uses ``nose.tools.assert_*`` functions, yet with pytest you can use raw assertions. If you add tests, which of
8383
these two approaches should a developer use? If you modify existing tests, should new assertions use raw assert?
8484
Should the remaining test method, test class, or test module be updated? A test module can contain hundreds of
8585
calls to ``nose.tools.assert_*`` functions, is a developer to manually go through each one to convert it? Painful and
8686
error prone, in general not feasible to do manually.
8787

88-
This is why I developed nose2pytest: I wanted to migrate my pypubsub project's test suite from Nose to py.test,
89-
but also have only py.test as a dependency, and have one obvious way to write assertions in the test suite.
88+
This is why I developed nose2pytest: I wanted to migrate my pypubsub project's test suite from Nose to pytest,
89+
but also have only pytest as a dependency, and have one obvious way to write assertions in the test suite.
9090

9191

9292
Requirements
@@ -102,7 +102,7 @@ Nose 1.3.7 on Windows 7 Pro 64. If you have successfully used nose2pytest with o
102102
kindly let me know (via github).
103103

104104
The pytest package namespace will be extended with ``assert_`` functions that are not converted by the script
105-
only if, err, you have py.test installed!
105+
only if, err, you have pytest installed!
106106

107107

108108
Status
@@ -187,7 +187,7 @@ Not every ``assert_*`` function from ``nose.tools`` is converted by nose2pytest:
187187

188188
The nose2pytest distribution contains a module, ``assert_tools.py`` which defines these utility functions to
189189
contain the equivalent raw assert statement. Copy the module into your test folder or into the pytest package
190-
and change your test code's ``from nose.tools import ...`` statements accordingly. Py.test introspection will
190+
and change your test code's ``from nose.tools import ...`` statements accordingly. pytest introspection will
191191
provide error information on assertion failure.
192192

193193
3. Some Nose functions don't have a one-line assert statement equivalent, they have to remain utility functions:

nose2pytest/assert_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
This module's assert_ functions provide drop-in replacements for nose.tools.assert_ functions (many of which are
77
pep-8-ized extractions from Python's unittest.case.TestCase methods). As such, it can be imported in a test
8-
suite run by py.test, to replace the nose imports with functions that rely on py.test's assertion
8+
suite run by pytest, to replace the nose imports with functions that rely on pytest's assertion
99
introspection for error reporting. When combined with running nose2pytest.py on your test suite, this
1010
module may be sufficient to decrease your test suite's third-party dependencies by 1.
1111
"""
@@ -93,7 +93,7 @@ def do_nothing(self):
9393
del _t
9494

9595

96-
# py.test integration: add all assert_ function to the pytest package namespace
96+
# pytest integration: add all assert_ function to the pytest package namespace
9797

9898
# Use similar trick as Nose to bring in bound methods from unittest.TestCase as free functions:
9999

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
description='Convert nose.tools.assert_ calls found in your Nose test modules into raw asserts for pytest',
2020
keywords='nose to pytest conversion',
2121

22+
python_requires='>=3.5',
2223
classifiers=[
2324
# How mature is this project? Common values are
2425
# 3 - Alpha
@@ -34,8 +35,11 @@
3435
'License :: OSI Approved :: BSD License',
3536

3637
# Specify the Python versions you support here.
37-
'Programming Language :: Python :: 3.4',
38+
'Programming Language :: Python :: 3',
39+
'Programming Language :: Python :: 3 :: Only',
3840
'Programming Language :: Python :: 3.5',
3941
'Programming Language :: Python :: 3.6',
42+
'Programming Language :: Python :: 3.7',
43+
'Programming Language :: Python :: 3.8',
4044
],
4145
)

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[tox]
2-
envlist = py34, py35, py36, py37, py38
2+
envlist = py35, py36, py37, py38
33

44
[testenv]
55
deps =
66
pytest
77
nose
88

9-
commands = py.test
9+
commands = pytest

0 commit comments

Comments
 (0)