Skip to content

Commit

Permalink
Don’t use pytest plugins by default
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Sep 6, 2022
1 parent bdd9cc2 commit 3256773
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip and setuptools
run: python -m pip install --upgrade pip setuptools
- name: Install tests's requirements
- name: Install tests requirements
run: python -m pip install .[test]
- name: Launch tests
run: python -m pytest
- name: Check coding style
run: python -m flake8 --exclude tests/css-parsing-tests
- name: Check imports order
run: python -m isort . --check --diff
25 changes: 15 additions & 10 deletions docs/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ install tinycss2 dependencies.
git clone https://github.com/Kozea/tinycss2.git
cd tinycss2
python -m venv venv
venv/bin/pip install .[doc,test]
venv/bin/pip install -e .[doc,test]
You can then let your terminal in the current directory and launch Python to
test your changes. ``import tinycss2`` will then import the working directory
code, so that you can modify it and test your changes.
You can then launch Python to test your changes.

.. code-block:: shell
Expand All @@ -27,8 +25,8 @@ code, so that you can modify it and test your changes.
Code & Issues
-------------

If you’ve found a bug in tinycss2, it’s time to report it, and to fix it if you
can!
If you’ve found a bug in tinycss2, it’s time to report it, and to fix it if
you can!

You can report bugs and feature requests on GitHub_. If you want to add or
fix some code, please fork the repository and create a pull request, we’ll be
Expand All @@ -43,11 +41,19 @@ Tests
Tests are stored in the ``tests`` folder at the top of the repository. They use
the pytest_ library.

You can launch tests (with code coverage and lint) using the following command::
You can launch tests using the following command::

venv/bin/python -m pytest

tinycss2 also uses isort_ to check imports and flake8_ to check the coding
style::

venv/bin/python -m isort . --check --diff
venv/bin/python -m flake8 --exclude tests/css-parsing-tests

.. _pytest: https://docs.pytest.org/
.. _isort: https://pycqa.github.io/isort/
.. _flake8: https://flake8.pycqa.org/


Documentation
Expand All @@ -60,8 +66,7 @@ You can build the documentation using the following command::

venv/bin/sphinx-build docs docs/_build

The documentation home page can now be found in the
``/path/to/tinycss2/docs/_build/index.html`` file. You can open this file in a
browser to see the final rendering.
The documentation home page can now be found in the ``docs/_build/index.html``
file. You can open this file in a browser to see the final rendering.

.. _Sphinx: https://www.sphinx-doc.org/
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ Donation = 'https://opencollective.com/courtbouillon'

[project.optional-dependencies]
doc = ['sphinx', 'sphinx_rtd_theme']
test = ['pytest', 'pytest-xdist', 'pytest-flake8', 'pytest-isort', 'pytest-cov', 'coverage[toml]']
test = ['pytest', 'isort', 'flake8']

[tool.flit.sdist]
exclude = ['.*']

[tool.pytest.ini_options]
addopts = '--isort --flake8 --numprocesses=auto'
norecursedirs = ['tests/css-parsing-tests']

[tool.coverage.run]
Expand All @@ -60,3 +59,4 @@ omit = ['.*']
[tool.isort]
default_section = 'FIRSTPARTY'
multi_line_output = 4
extend_skip = ['tests/css-parsing-tests']

0 comments on commit 3256773

Please sign in to comment.