Skip to content

Version bump CI tools #940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 56 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
54d0fc1
Version bump CI tools
felixdivo Nov 19, 2020
4a4f4a7
run black on newer version
felixdivo Nov 19, 2020
8be488e
revert version bump (it's now in #940) and format repository
felixdivo Nov 19, 2020
b07278b
Revert "revert version bump (it's now in #940) and format repository"
felixdivo Nov 19, 2020
94a5ebe
Merge branch 'develop' into felixdivo-patch-update-ci-tools
felixdivo Nov 20, 2020
dd42c28
update travis CI
felixdivo Nov 20, 2020
abb3cef
Merge branch 'develop' into felixdivo-patch-update-ci-tools
felixdivo Nov 21, 2020
24f5b26
move most tests from travis to gitlab actions
felixdivo Nov 26, 2020
d1b5637
Merge branch 'develop' into felixdivo-patch-update-ci-tools
felixdivo Nov 26, 2020
dab3c86
Format code with black
felixdivo Nov 26, 2020
61b5e16
fix python version 3.10.0-alpha.2 on github actions
felixdivo Nov 26, 2020
5d4eb03
Update python 3.10 pre-release
felixdivo Jan 23, 2021
9d10f35
bump pylint version
felixdivo Apr 10, 2021
2adcd75
incorporate feedback
felixdivo Apr 10, 2021
2a934c2
version bumpy mypy
felixdivo Apr 10, 2021
6f53811
Format code with black
felixdivo Apr 10, 2021
60f6cdf
Update build.yml
zariiii9003 Apr 11, 2021
6ba02f9
update format-code.yml to most recent python versions
felixdivo Apr 12, 2021
4198a35
separate out the black formatter
felixdivo Apr 12, 2021
a4a4546
Merge branch 'develop' into felixdivo-patch-update-ci-tools
felixdivo Apr 12, 2021
896fae7
skip BasicTestUdpMulticastBusIPv4/BasicTestUdpMulticastBusIPv6 on all…
felixdivo Apr 12, 2021
3fdd6ea
add GITHUB_ACTIONS variable
felixdivo Apr 12, 2021
c57480b
fix PCAN error on macOS on GitHub Actions
felixdivo Apr 12, 2021
05942c9
Format code with black
felixdivo Apr 12, 2021
efc5f26
skip TestMessageSync in some more CI configurations
felixdivo Apr 12, 2021
40a7ac5
Merge branch 'felixdivo-patch-update-ci-tools' of github.com:hardbyte…
felixdivo Apr 12, 2021
ad735c8
pass environment variable GITHUB_ACTIONS
zariiii9003 Apr 13, 2021
592265e
Update tox.ini
zariiii9003 Apr 13, 2021
91485bf
set fail-fast to false
zariiii9003 Apr 13, 2021
a35c35d
improve error message in viewer.py
felixdivo Apr 13, 2021
011e3a5
only install windows-curses on CPython (and only on Windows, obviously)
felixdivo Apr 13, 2021
e5d7ca3
Merge branch 'felixdivo-patch-update-ci-tools' of github.com:hardbyte…
felixdivo Apr 13, 2021
f20932a
only install windows-curses on CPython (and only on Windows, obviousl…
felixdivo Apr 13, 2021
8f75e14
only install pywin32 on CPython
felixdivo Apr 13, 2021
0736b15
do not install tox in formatter job
felixdivo Apr 13, 2021
f12e84f
skip timing tests in unreliable environments
felixdivo Apr 13, 2021
3b0be9b
try to fix test under Windows/tox
zariiii9003 Apr 13, 2021
11967df
Format code with black
zariiii9003 Apr 13, 2021
34641fa
Allow the curses module to be missing in test_viewer.py (e.g. on PyPy…
felixdivo Apr 13, 2021
f8c2acd
Merge branch 'felixdivo-patch-update-ci-tools' of github.com:hardbyte…
felixdivo Apr 13, 2021
4595fa4
Format code with black
felixdivo Apr 13, 2021
1fc6ae2
workaround for ImportError when curses is unavailable
zariiii9003 Apr 13, 2021
6ef94a2
update badge for travis-ci.com
zariiii9003 Apr 13, 2021
18ecd70
raise timeout for PyPy
zariiii9003 Apr 13, 2021
909d783
colored output for github actions
zariiii9003 Apr 13, 2021
8547f07
pass PY_COLORS to github tox environment
zariiii9003 Apr 13, 2021
e96417d
call codecov after GHA tests
zariiii9003 Apr 13, 2021
39dc1e3
disable deadline healthcheck on test_message_class.py
felixdivo Apr 14, 2021
06bfdb9
make deadline still count on platforms other than GHA
felixdivo Apr 14, 2021
5a43b00
Format code with black
felixdivo Apr 14, 2021
f2c93ba
skip test_asyncio_notifier on python 3.10
felixdivo Apr 14, 2021
544ba4b
Merge branch 'felixdivo-patch-update-ci-tools' of github.com:hardbyte…
felixdivo Apr 14, 2021
4287818
Format code with black
felixdivo Apr 14, 2021
43ec7c9
Update test/config.py
felixdivo Apr 14, 2021
37b9fd5
Merge branch 'develop' into felixdivo-patch-update-ci-tools
felixdivo Apr 14, 2021
316a881
Format code with black
felixdivo Apr 14, 2021
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
32 changes: 27 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,49 @@ name: Tests

on: [push, pull_request]

env:
PY_COLORS: "1"

jobs:
build:
runs-on: ubuntu-latest
test:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }} # See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
experimental: [false]
python-version: [3.6, 3.7, 3.8, 3.9, pypy3]
include:
- python-version: 3.10.0-alpha.7 # Newest: https://github.com/actions/python-versions/blob/main/versions-manifest.json
os: ubuntu-latest
experimental: true
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install -r requirements-lint.txt
- name: Test with pytest via tox
run: |
tox -e gh

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-lint.txt
- name: Code Format Check with Black
run: |
black --check --verbose .
4 changes: 2 additions & 2 deletions .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
43 changes: 6 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,32 @@
language: python

# Linux setup
dist: xenial
dist: focal

cache:
directories:
- "$HOME/.cache/pip"

python:
# CPython; only 3.6 is supported
- "3.6"
- "3.7"
- "3.8"
- nightly
# PyPy:
- pypy3

env:


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

script:
- |
# install tox
pip install tox
travis_retry pip install tox
# Run the tests
tox -e travis

jobs:
allow_failures:
# we allow all dev & nightly builds to fail, since these python versions might
# still be very unstable
- python: nightly
# Allow arm64 builds to fail
- arch: arm64

include:
# Note no matrix support when using stages.
# Stages with the same name get run in parallel.
# Jobs within a stage can also be named.

# Unit Testing Stage

# testing socketcan on Trusty & Python 3.6, since it is not available on Xenial
- stage: test
name: Socketcan
Expand Down Expand Up @@ -72,15 +54,9 @@ jobs:
- sudo update-alternatives --install /usr/bin/python python $(which python3) 10
- sudo update-alternatives --install /usr/bin/pip pip $(which pip3) 10

# testing on OSX
- stage: test
os: osx
osx_image: xcode8.3
python: 3.6-dev

- stage: documentation
name: "Sphinx Build"
python: "3.7"
python: "3.9"
before_install:
- travis_retry pip install -r doc/doc-requirements.txt
script:
Expand All @@ -90,7 +66,7 @@ jobs:
- python -m sphinx -an doc build
- stage: linter
name: "Linter Checks"
python: "3.7"
python: "3.9"
before_install:
- travis_retry pip install -r requirements-lint.txt
script:
Expand Down Expand Up @@ -132,16 +108,9 @@ jobs:
can/io/**.py
scripts/**.py
examples/**.py
- stage: linter
name: "Formatting Checks"
python: "3.7"
before_install:
- travis_retry pip install -r requirements-lint.txt
script:
- black --check --verbose .
- stage: deploy
name: "PyPi Deployment"
python: "3.7"
python: "3.9"
deploy:
provider: pypi
user: hardbyte
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ python-can
:target: https://python-can.readthedocs.io/en/stable/
:alt: Documentation

.. |build_travis| image:: https://img.shields.io/travis/hardbyte/python-can/develop.svg?label=Travis%20CI
:target: https://travis-ci.org/hardbyte/python-can/branches
.. |build_travis| image:: https://img.shields.io/travis/com/hardbyte/python-can/develop.svg?label=Travis%20CI
:target: https://travis-ci.com/hardbyte/python-can
:alt: Travis CI Server for develop branch

.. |build_appveyor| image:: https://img.shields.io/appveyor/ci/hardbyte/python-can/develop.svg?label=AppVeyor
Expand Down
4 changes: 1 addition & 3 deletions can/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@


class CanError(IOError):
"""Indicates an error with the CAN network.

"""
"""Indicates an error with the CAN network."""


from .listener import Listener, BufferedReader, RedirectReader, AsyncBufferedReader
Expand Down
6 changes: 2 additions & 4 deletions can/broadcastmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ class RestartableCyclicTaskABC(CyclicSendTaskABC):

@abc.abstractmethod
def start(self):
"""Restart a stopped periodic task.
"""
"""Restart a stopped periodic task."""


class ModifiableCyclicTaskABC(CyclicSendTaskABC):
Expand Down Expand Up @@ -170,8 +169,7 @@ def modify_data(self, messages: Union[Sequence[Message], Message]):


class MultiRateCyclicSendTaskABC(CyclicSendTaskABC):
"""A Cyclic send task that supports switches send frequency after a set time.
"""
"""A Cyclic send task that supports switches send frequency after a set time."""

def __init__(
self,
Expand Down
7 changes: 3 additions & 4 deletions can/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def recv(self, timeout: Optional[float] = None) -> Optional[Message]:

if time_left > 0:
continue
else:
return None

return None

def _recv_internal(
self, timeout: Optional[float]
Expand Down Expand Up @@ -388,8 +388,7 @@ def _matches_filters(self, msg: Message) -> bool:
return False

def flush_tx_buffer(self):
"""Discard every message that may be queued in the output buffer(s).
"""
"""Discard every message that may be queued in the output buffer(s)."""

def shutdown(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion can/ctypesutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def map_symbol(self, func_name, restype=None, argtypes=(), errcheck=None):
"Could not map function '{}' from library {}".format(
func_name, self._name
)
)
) from None

setattr(symbol, "_name", func_name)
log.debug(
Expand Down
8 changes: 5 additions & 3 deletions can/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def _get_class_for_interface(interface):
try:
module_name, class_name = BACKENDS[interface]
except KeyError:
raise NotImplementedError("CAN interface '{}' not supported".format(interface))
raise NotImplementedError(
"CAN interface '{}' not supported".format(interface)
) from None

# Import the correct interface module
try:
Expand All @@ -39,7 +41,7 @@ def _get_class_for_interface(interface):
"Cannot import module {} for CAN interface '{}': {}".format(
module_name, interface, e
)
)
) from None

# Get the correct class
try:
Expand All @@ -49,7 +51,7 @@ def _get_class_for_interface(interface):
"Cannot import class {} from module {} for CAN interface '{}': {}".format(
class_name, module_name, interface, e
)
)
) from None

return bus_class

Expand Down
40 changes: 20 additions & 20 deletions can/interfaces/ixxat/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@


def __vciFormatErrorExtended(library_instance, function, HRESULT, arguments):
""" Format a VCI error and attach failed function, decoded HRESULT and arguments
:param CLibrary library_instance:
Mapped instance of IXXAT vcinpl library
:param callable function:
Failed function
:param HRESULT HRESULT:
HRESULT returned by vcinpl call
:param arguments:
Arbitrary arguments tuple
:return:
Formatted string
"""Format a VCI error and attach failed function, decoded HRESULT and arguments
:param CLibrary library_instance:
Mapped instance of IXXAT vcinpl library
:param callable function:
Failed function
:param HRESULT HRESULT:
HRESULT returned by vcinpl call
:param arguments:
Arbitrary arguments tuple
:return:
Formatted string
"""
# TODO: make sure we don't generate another exception
return "{} - arguments were {}".format(
Expand All @@ -80,15 +80,15 @@ def __vciFormatErrorExtended(library_instance, function, HRESULT, arguments):


def __vciFormatError(library_instance, function, HRESULT):
""" Format a VCI error and attach failed function and decoded HRESULT
:param CLibrary library_instance:
Mapped instance of IXXAT vcinpl library
:param callable function:
Failed function
:param HRESULT HRESULT:
HRESULT returned by vcinpl call
:return:
Formatted string
"""Format a VCI error and attach failed function and decoded HRESULT
:param CLibrary library_instance:
Mapped instance of IXXAT vcinpl library
:param callable function:
Failed function
:param HRESULT HRESULT:
HRESULT returned by vcinpl call
:return:
Formatted string
"""
buf = ctypes.create_string_buffer(constants.VCI_MAX_ERRSTRLEN)
ctypes.memset(buf, 0, constants.VCI_MAX_ERRSTRLEN)
Expand Down
5 changes: 2 additions & 3 deletions can/interfaces/kvaser/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,8 +538,7 @@ def _apply_filters(self, filters):
pass

def flush_tx_buffer(self):
""" Wipeout the transmit buffer on the Kvaser.
"""
"""Wipeout the transmit buffer on the Kvaser."""
canIoCtl(self._write_handle, canstat.canIOCTL_FLUSH_TX_BUFFER, 0, 0)

def _recv_internal(self, timeout=None):
Expand Down Expand Up @@ -659,7 +658,7 @@ def get_stats(self):

:returns: bus statistics.
:rtype: can.interfaces.kvaser.structures.BusStatistics
"""
"""
canRequestBusStatistics(self._write_handle)
stats = structures.BusStatistics()
canGetBusStatistics(
Expand Down
37 changes: 18 additions & 19 deletions can/interfaces/pcan/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,7 @@ class TPCANChannelInformation(Structure):


class PCANBasic:
"""PCAN-Basic API class implementation
"""
"""PCAN-Basic API class implementation"""

def __init__(self):
# Loads the PCANBasic.dll and checks if driver is available
Expand Down Expand Up @@ -629,25 +628,25 @@ def Initialize(
def InitializeFD(self, Channel, BitrateFD):

"""
Initializes a FD capable PCAN Channel

Parameters:
Channel : The handle of a FD capable PCAN Channel
BitrateFD : The speed for the communication (FD bit rate string)
Initializes a FD capable PCAN Channel

Remarks:
See PCAN_BR_* values.
* parameter and values must be separated by '='
* Couples of Parameter/value must be separated by ','
* Following Parameter must be filled out: f_clock, data_brp, data_sjw, data_tseg1, data_tseg2,
nom_brp, nom_sjw, nom_tseg1, nom_tseg2.
* Following Parameters are optional (not used yet): data_ssp_offset, nom_samp
Parameters:
Channel : The handle of a FD capable PCAN Channel
BitrateFD : The speed for the communication (FD bit rate string)

Example:
f_clock=80000000,nom_brp=10,nom_tseg1=5,nom_tseg2=2,nom_sjw=1,data_brp=4,data_tseg1=7,data_tseg2=2,data_sjw=1

Returns:
A TPCANStatus error code
Remarks:
See PCAN_BR_* values.
* parameter and values must be separated by '='
* Couples of Parameter/value must be separated by ','
* Following Parameter must be filled out: f_clock, data_brp, data_sjw, data_tseg1, data_tseg2,
nom_brp, nom_sjw, nom_tseg1, nom_tseg2.
* Following Parameters are optional (not used yet): data_ssp_offset, nom_samp

Example:
f_clock=80000000,nom_brp=10,nom_tseg1=5,nom_tseg2=2,nom_sjw=1,data_brp=4,data_tseg1=7,data_tseg2=2,data_sjw=1

Returns:
A TPCANStatus error code
"""
try:
res = self.__m_dllBasic.CAN_InitializeFD(Channel, BitrateFD)
Expand Down
Loading