Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ install:
# Prepend Python installation and scripts (e.g. pytest) to PATH
- set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%

# We need to install the python-can library itself including the dependencies
- "python -m pip install .[test,neovi]"
# Install tox
- "pip install tox"

build: off

test_script:
# run tests
- "pytest"

# uplad coverage reports
- "codecov -X gcov"
- "tox -e appveyor"
13 changes: 4 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@ env:

install:
- if [[ "$TEST_SOCKETCAN" ]]; then sudo bash test/open_vcan.sh ; fi
- travis_retry pip install .[test]
- python setup.py install

script:
- |
# install tox
pip install tox
# Run the tests
python setup.py test
# preserve the error code
RETURN_CODE=$?
# Upload the coverage to codecov.io
codecov -X gcov
# set error code
(exit $RETURN_CODE);

tox -e travis

jobs:
allow_failures:
Expand Down
34 changes: 25 additions & 9 deletions doc/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,30 @@ Building & Installing

The following assumes that the commands are executed from the root of the repository:

- The project can be built and installed with ``python setup.py build`` and
``python setup.py install``.
- The unit tests can be run with ``python setup.py test``. The tests can be run with ``python2``,
``python3``, ``pypy`` or ``pypy3`` to test with other python versions, if they are installed.
Maybe, you need to execute ``pip3 install python-can[test]`` (or only ``pip`` for Python 2),
if some dependencies are missing.
- The docs can be built with ``sphinx-build doc/ doc/_build``. Appending ``-n`` to the command
makes Sphinx complain about more subtle problems.
The project can be built with::

pip install wheel
python setup.py sdist bdist_wheel

The project can be installed in editable mode with::

pip install -e .

The unit tests can be run with::

pip install tox
tox

The documentation can be built with::

pip install -r doc/doc-requirements.txt
python -m sphinx -an doc build

The linters can be run with::

pip install -r requirements-lint.txt
pylint --rcfile=.pylintrc-wip can/**.py
black --check --verbose can


Creating a new interface/backend
Expand Down Expand Up @@ -81,7 +97,7 @@ Creating a new Release
- Update `CONTRIBUTORS.txt` with any new contributors.
- For larger changes update ``doc/history.rst``.
- Sanity check that documentation has stayed inline with code.
- Create a temporary virtual environment. Run ``python setup.py install`` and ``python setup.py test``.
- Create a temporary virtual environment. Run ``python setup.py install`` and ``tox``.
- Create and upload the distribution: ``python setup.py sdist bdist_wheel``.
- Sign the packages with gpg ``gpg --detach-sign -a dist/python_can-X.Y.Z-py3-none-any.whl``.
- Upload with twine ``twine upload dist/python-can-X.Y.Z*``.
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools >= 40.8",
"wheel",
]
build-backend = "setuptools.build_meta"
23 changes: 0 additions & 23 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,25 +1,2 @@
[aliases]
test=pytest

[metadata]
license_file = LICENSE.txt

[tool:pytest]
addopts = -v --timeout=300 --cov=can --cov-config=setup.cfg

[coverage:run]
# we could also use branch coverage
branch = False
# already specified by call to pytest using --cov=can
#source = can

[coverage:report]
# two digits after decimal point
precision = 3
show_missing = True
exclude_lines =
# Have to re-enable the standard pragma, see https://coverage.readthedocs.io/en/coverage-4.5.1a/config.html#syntax
pragma: no cover

# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.:
26 changes: 1 addition & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from os.path import isfile, join
import re
import logging
import sys
from setuptools import setup, find_packages

logging.basicConfig(level=logging.WARNING)
Expand All @@ -29,30 +28,9 @@
extras_require = {
"seeedstudio": ["pyserial>=3.0"],
"serial": ["pyserial~=3.0"],
"neovi": ["python-ics>=2.12", "filelock"],
"neovi": ["python-ics>=2.12"],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this change be here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily, but i noticed that filelock is mentioned in install_requires already.

}

tests_require = [
"pytest~=5.3",
"pytest-timeout~=1.3",
"pytest-cov~=2.8",
# coveragepy==5.0 fails with `Safety level may not be changed inside a transaction`
# on python 3.6 on MACOS
"coverage<5",
"codecov~=2.0",
"hypothesis~=4.56",
] + extras_require["serial"]

extras_require["test"] = tests_require

# Check for 'pytest-runner' only if setup.py was invoked with 'test'.
# This optimizes setup.py for cases when pytest-runner is not needed,
# using the approach that is suggested upstream.
#
# See https://pypi.org/project/pytest-runner/#conditional-requirement
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
pytest_runner = ["pytest-runner"] if needs_pytest else []

setup(
# Description
name="python-can",
Expand Down Expand Up @@ -110,7 +88,5 @@
"mypy_extensions >= 0.4.0, < 0.5.0",
'pywin32;platform_system=="Windows"',
],
setup_requires=pytest_runner,
extras_require=extras_require,
tests_require=tests_require,
)
59 changes: 54 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,60 @@
[tox]
envlist = py36, py37

[testenv]
deps =
pytest~=5.3
pytest-timeout~=1.3
pytest-cov~=2.8
coverage<5
codecov~=2.0
hypothesis~=4.56
pyserial~=3.0

commands =
pip install .[test]
pytest
passenv = CI

recreate = True
usedevelop = True
sitepackages=False

[testenv:travis]
passenv =
CI
TRAVIS
TRAVIS_*
TEST_SOCKETCAN

commands_post =
codecov -X gcov

[testenv:appveyor]
passenv =
CI
APPVEYOR
APPVEYOR_*

extras = neovi

commands_post =
codecov -X gcov

[pytest]
testpaths = test
addopts = -v --timeout=300 --cov=can --cov-append --cov-report=term


[coverage:run]
# we could also use branch coverage
branch = False

[coverage:report]
# two digits after decimal point
precision = 3
show_missing = True
exclude_lines =
# Have to re-enable the standard pragma, see https://coverage.readthedocs.io/en/coverage-4.5.1a/config.html#syntax
pragma: no cover

# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.:

# Don't complain if tests don't hit defensive assertion code:
raise NotImplementedError