Skip to content

Commit 509247c

Browse files
committed
tests: Stop using deprecated 'python setup.py test'
Using `python setup.py test` is now deprecated [1], users are encouraged to be explicit about the test command. Running yamllint tests using the Python standard library (`unittest`) can be done using: python -m unittest discover Why not nose, tox or pytest? Because they would add a dependency, make tests running more complicated and verbose for new users, and their benefit is not worth for this simple projects (only 2 runtime dependencies: PyYAML and pathspec). [1]: pypa/setuptools#1878
1 parent 1a4f9fe commit 509247c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ script:
2020
- if [[ $TRAVIS_PYTHON_VERSION != nightly ]]; then flake8 .; fi
2121
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then doc8 $(git ls-files '*.rst'); fi
2222
- yamllint --strict $(git ls-files '*.yaml' '*.yml')
23-
- coverage run --source=yamllint setup.py test
23+
- coverage run --source=yamllint -m unittest discover
2424
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then
2525
python setup.py build_sphinx;
2626
fi

CONTRIBUTING.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Pull Request Process
1313

1414
.. code:: bash
1515
16-
python setup.py test
16+
python -m unittest discover # all tests...
17+
python -m unittest tests/rules/test_commas.py # or just some tests (faster)
1718
1819
3. If you add code that should be tested, add tests.
1920

0 commit comments

Comments
 (0)