Skip to content

Commit 7afacef

Browse files
felixdivohardbyte
authored andcommitted
More test platforms, most notably OSX (#244)
* added osx to travis test targets * Improve test failure messages * Make timing tests more forgiving for travis
1 parent c474296 commit 7afacef

File tree

6 files changed

+50
-12
lines changed

6 files changed

+50
-12
lines changed

.travis.yml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,47 @@
11
language: python
2-
sudo: false
2+
33
python:
4+
# CPython:
45
- "2.7"
5-
- "pypy"
6-
- "pypy3"
6+
- "3.3"
77
- "3.4"
88
- "3.5"
99
- "3.6"
10-
- "3.7-dev"
10+
- "3.7-dev" # TODO: change to "3.7" once it gets released
1111
- "nightly"
12+
# PyPy:
13+
- "pypy"
14+
- "pypy3"
15+
16+
os:
17+
- linux # Linux is officially supported and we test the library under
18+
# many different Python verions (see "python: ..." above)
19+
20+
# - osx # OSX + Python is not officially supported by Travis CI as of Feb. 2018
21+
# nevertheless, "nightly" and some "*-dev" versions seem to work, so we
22+
# include them explicitly below (see "matrix: include: ..." below)
23+
24+
# - windows # Windows is not supported at all by Travis CI as of Feb. 2018
25+
26+
# Linux setup
27+
dist: trusty
28+
sudo: false
29+
30+
matrix:
31+
# see "os: ..." above
32+
include:
33+
- os: osx
34+
python: "3.6-dev"
35+
- os: osx
36+
python: "3.7-dev"
37+
- os: osx
38+
python: "nightly"
39+
40+
# allow all nighly builds to fail, since these python versions might be unstable
41+
# we do not allow dev builds to fail, since these builds are stable enough
42+
allow_failures:
43+
- python: "nightly"
44+
1245
install:
1346
- travis_retry pip install .
1447
- travis_retry pip install -r requirements.txt

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ python-can
1212
:alt: Documentation Status
1313

1414
.. |build| image:: https://travis-ci.org/hardbyte/python-can.svg?branch=develop
15-
:target: https://travis-ci.org/hardbyte/python-can
15+
:target: https://travis-ci.org/hardbyte/python-can/branches
1616
:alt: CI Server for develop branch
1717

1818

@@ -26,7 +26,7 @@ Python developers; providing `common abstractions to
2626
different hardware devices`, and a suite of utilities for sending and receiving
2727
messages on a can bus.
2828

29-
The library supports Python 2.7, Python 3.3+ and runs on Mac, Linux and Windows.
29+
The library supports Python 2.7, Python 3.3+ as well as PyPy and runs on Mac, Linux and Windows.
3030

3131
You can find more information in the documentation, online at
3232
`python-can.readthedocs.org <https://python-can.readthedocs.org/en/stable/>`__.

can/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import logging
77

8-
__version__ = "2.0.0"
8+
__version__ = "2.1.0.rc2"
99

1010
log = logging.getLogger('can')
1111

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
# -*- coding: utf-8 -*-
2+
13
"""
24
python-can requires the setuptools package to be installed.
35
"""
6+
47
import re
58
import logging
69
from setuptools import setup, find_packages

test/back2back_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ def test_no_message(self):
7070
def test_timestamp(self):
7171
self.bus2.send(can.Message())
7272
recv_msg1 = self.bus1.recv(TIMEOUT)
73-
time.sleep(1)
73+
time.sleep(5)
7474
self.bus2.send(can.Message())
7575
recv_msg2 = self.bus1.recv(TIMEOUT)
7676
delta_time = recv_msg2.timestamp - recv_msg1.timestamp
77-
self.assertTrue(0.95 < delta_time < 1.05)
77+
self.assertTrue(4.8 < delta_time < 5.2,
78+
'Time difference should have been 5s +/- 200ms.'
79+
'But measured {}'.format(delta_time))
7880

7981
def test_standard_message(self):
8082
msg = can.Message(extended_id=False,

test/simplecyclic_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ def test_cycle_time(self):
1212
task = bus.send_periodic(msg, 0.01, 1)
1313
self.assertIsInstance(task, can.broadcastmanager.CyclicSendTaskABC)
1414

15-
sleep(1.5)
15+
sleep(5)
1616
size = bus2.queue.qsize()
17-
print(size)
1817
# About 100 messages should have been transmitted
19-
self.assertTrue(90 < size < 110)
18+
self.assertTrue(90 < size < 110,
19+
'100 +/- 10 messages should have been transmitted. But queue contained {}'.format(size))
2020
last_msg = bus2.recv()
2121
self.assertEqual(last_msg, msg)
2222

0 commit comments

Comments
 (0)