Skip to content

Commit 924e5ed

Browse files
committed
move scripts back to the old location in python-can/can/*
1 parent 132b8a2 commit 924e5ed

9 files changed

Lines changed: 19 additions & 30 deletions

File tree

can/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,3 @@ class CanError(IOError):
4747
ModifiableCyclicTaskABC, \
4848
MultiRateCyclicSendTaskABC, \
4949
RestartableCyclicTaskABC
50-
51-
from .scripts import *
File renamed without changes.
File renamed without changes.

can/scripts/__init__.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

doc/scripts.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ Scripts
33

44
The following modules are callable from python-can.
55

6-
They can either be called by for example ``python -m can.logger`` or ``can_logger.py`` (if installed by pip).
7-
The scripts are internally placed in the module ``can.scripts.*``,
8-
so they could also be launched by ``python -m can.scripts.logger``.
6+
They can be called for example by ``python -m can.logger`` or ``can_logger.py`` (if installed using pip).
97

108

119
can.logger

scripts/can_logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# coding: utf-8
33

44
"""
5-
See :mod:`can.scripts.logger`.
5+
See :mod:`can.logger`.
66
"""
77

88
from __future__ import absolute_import
99

10-
from can.scripts.logger import main
10+
from can.logger import main
1111

1212

1313
if __name__ == "__main__":

scripts/can_player.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# coding: utf-8
33

44
"""
5-
See :mod:`can.scripts.player`.
5+
See :mod:`can.player`.
66
"""
77

88
from __future__ import absolute_import
99

10-
from can.scripts.player import main
10+
from can.player import main
1111

1212

1313
if __name__ == "__main__":

setup.cfg

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ branch = False
1515
omit =
1616
# legacy code
1717
can/CAN.py
18-
can/logger.py
19-
can/player.py
2018

2119
[coverage:report]
2220
# two digits after decimal point
23-
precision = 2
21+
precision = 3
2422
show_missing = True
2523
exclude_lines =
2624
# Have to re-enable the standard pragma, see https://coverage.readthedocs.io/en/coverage-4.5.1a/config.html#syntax

test/test_scripts.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,20 @@ class CanScriptTest(unittest.TestCase):
1919

2020
@classmethod
2121
def setUpClass(cls):
22-
# clean out the argument list
22+
# clean up the argument list so the call to the main() functions
23+
# in test_does_not_crash() succeeds
2324
sys.argv = sys.argv[:1]
2425

26+
#: this is override by the subclasses
2527
__test__ = False
2628

2729
__metaclass__ = ABCMeta
2830

2931
#@unittest.skipUnless(IS_UNIX, "commands may only be available on unix")
3032
def test_do_commands_exist(self):
3133
"""This test calls each scripts once and veifies that the help
32-
can be read without any errors.
34+
can be read without any other errors, like the script not being
35+
found.
3336
"""
3437
for command in self._commands():
3538
try:
@@ -38,6 +41,9 @@ def test_do_commands_exist(self):
3841
self.assertEqual(e.returncode, errno.EINVAL,
3942
'Calling "{}" failed (exit code was {} and not EINVAL/22):\n{}'
4043
.format(command, e.returncode, e.output))
44+
else:
45+
# this is also okay
46+
pass
4147

4248
def test_does_not_crash(self):
4349
# test import
@@ -50,10 +56,15 @@ def test_does_not_crash(self):
5056

5157
@abstractmethod
5258
def _commands(self):
59+
"""Returns an Iterable of commands that should "succeed", meaning they exit
60+
normally (exit code 0) or with the exit code for invalid arguments: EINVAL/22.
61+
"""
5362
pass
5463

5564
@abstractmethod
5665
def _import(self):
66+
"""Returns the modue of the script that has a main() function.
67+
"""
5768
pass
5869

5970

@@ -65,7 +76,6 @@ def _commands(self):
6576
return (
6677
"can_logger.py --help",
6778
"python -m can.logger --help",
68-
"python -m can.scripts.logger --help"
6979
)
7080

7181
def _import(self):
@@ -81,7 +91,6 @@ def _commands(self):
8191
return (
8292
"can_player.py --help",
8393
"python -m can.player --help",
84-
"python -m can.scripts.player --help"
8594
)
8695

8796
def _import(self):

0 commit comments

Comments
 (0)