Skip to content

Commit fd48e0a

Browse files
authored
Merge pull request #24 from bp100a/restructure-clean
Restructure clean
2 parents 9f101a6 + fb549ba commit fd48e0a

File tree

6 files changed

+638
-45
lines changed

6 files changed

+638
-45
lines changed

.github/workflows/poetry-build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ jobs:
4646
4747
- name: Install dependencies
4848
run: |
49-
poetry install
50-
python -m poetry run python -m pip install -r tool_requirements.txt
49+
poetry install --with tests
5150
5251
- name: lint
5352
run: |

poetry.lock

Lines changed: 563 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ classifiers = [
3333
"Topic :: System :: Hardware :: Universal Serial Bus (USB) :: Communications Device Class (CDC)",
3434

3535
# Specify the Python versions you support here.
36+
"Programming Language :: Python :: Implementation :: CPython",
37+
"Programming Language :: Python :: Implementation :: PyPy",
3638
"Programming Language :: Python",
3739
"Programming Language :: Python :: 3.11",
3840
"Programming Language :: Python :: 3.12",
@@ -46,7 +48,7 @@ Repository = "https://github.com/bp100a/serial-usbipclient"
4648
name = "serial-usbipclient"
4749
authors = ["Harry J. Collins <bp100a@gmail.com>"]
4850
maintainers = ["Harry J. Collins <bp100a@gmail.com>"]
49-
version = "0.1.3"
51+
version = "0.1.4"
5052
description = "Simple serial connectivity to CDC (serial) USB devices exposed by a USBIPD service."
5153
readme = "README.md"
5254
package-mode = true
@@ -55,6 +57,18 @@ package-mode = true
5557
python = "^3.11"
5658
py-datastruct = "^1.0.0"
5759

60+
[tool.poetry.group.tests.dependencies]
61+
pytest = "8.3.2"
62+
pytest-xdist = "3.6.1"
63+
coverage = "7.6.1"
64+
pylint = "3.2.6"
65+
pip-tools = "7.4.1"
66+
black = "24.8.0"
67+
pytest-cov = "5.0.0"
68+
pytest-timeout = "2.3.1"
69+
isort = "5.13.2"
70+
mypy = "1.11.2"
71+
5872
[tool.mypy]
5973
check_untyped_defs = true
6074
exclude = [
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
["serial_usbipclient.tests.test_connection.py.testusbipconnection.test_connection", "serial_usbipclient.tests.test_connection.py.testusbipconnection.test_connection_shutdown", "serial_usbipclient.tests.test_connection.py.testusbipconnection.test_queue_urbs", "serial_usbipclient.tests.test_descriptors.py.testinterfacedescriptor.test_descriptors", "serial_usbipclient.tests.test_mock_usbip_server.py.testmockusbipserver.test_mock_usbip_server_connection", "serial_usbipclient.tests.test_mock_usbip_server.py.testmockusbipserver.test_mock_usbip_server_startup", "serial_usbipclient.tests.test_mock_usbip_server.py.testmockusbipserver.test_mocked_response", "serial_usbipclient.tests.test_mock_usbip_server.py.testmockusbipserver.test_reading_paths", "serial_usbipclient.tests.test_mock_usbip_server.py.testdeviceconfiguration.test_lsusb_parsing", "serial_usbipclient.tests.test_mock_usbip_server.py.testdeviceconfiguration.test_usbip_path", "serial_usbipclient.tests.test_packaging.py.testversion.test_version", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_cmd_response", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_cmd_submit", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_iso_packet_descriptor", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_metastruct_size", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_queue_urb", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_request_devlist", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_sizing", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_urb_endianness", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_configuration", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_delimited_read", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_failed_attachment", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_hardware_id_formatting", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_invalid_response", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_no_read_response", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_no_write_response", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_read_timeout", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_read_write", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_readline", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_readline_timeout", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_restore_connection", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_restore_unattachable_connection", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_restore_unknown_connection", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_timeout_error", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_unknown_device", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_write_string", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_attachment", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_connection", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_gai_error", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_list_published", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_recv_error", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_restore_connection", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_restore_connection_no_device", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_timeout_error", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_configuration_descriptor", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_descriptor_handlers", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_endpoint_descriptor_handlers", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_generate_configuration", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_interface_association_handlers"]
1+
["serial_usbipclient.tests.test_connection.py.testusbipconnection.test_connection", "serial_usbipclient.tests.test_connection.py.testusbipconnection.test_connection_shutdown", "serial_usbipclient.tests.test_connection.py.testusbipconnection.test_queue_urbs", "serial_usbipclient.tests.test_descriptors.py.testinterfacedescriptor.test_descriptors", "serial_usbipclient.tests.test_exceptions.py.testexceptions.test_endpoint_exceptions", "serial_usbipclient.tests.test_mock_usbip_server.py.testmockusbipserver.test_mock_usbip_server_connection", "serial_usbipclient.tests.test_mock_usbip_server.py.testmockusbipserver.test_mock_usbip_server_startup", "serial_usbipclient.tests.test_mock_usbip_server.py.testmockusbipserver.test_mocked_response", "serial_usbipclient.tests.test_mock_usbip_server.py.testmockusbipserver.test_reading_paths", "serial_usbipclient.tests.test_mock_usbip_server.py.testdeviceconfiguration.test_lsusb_parsing", "serial_usbipclient.tests.test_mock_usbip_server.py.testdeviceconfiguration.test_usbip_path", "serial_usbipclient.tests.test_packaging.py.testversion.test_version", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_cmd_response", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_cmd_submit", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_iso_packet_descriptor", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_metastruct_size", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_queue_urb", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_request_devlist", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_sizing", "serial_usbipclient.tests.test_packet_generation.py.testpacketgeneration.test_urb_endianness", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_configuration", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_delimited_read", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_failed_attachment", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_hardware_id_formatting", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_invalid_response", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_no_read_response", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_no_write_response", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_read_timeout", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_read_write", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_readline", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_readline_timeout", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_restore_connection", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_restore_unattachable_connection", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_restore_unknown_connection", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_timeout_error", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_unknown_device", "serial_usbipclient.tests.test_rw_device.py.testreadwrite.test_write_string", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_attachment", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_connection", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_gai_error", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_list_published", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_recv_error", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_restore_connection", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_restore_connection_no_device", "serial_usbipclient.tests.test_socket_handling.py.testsocketwrapper.test_timeout_error", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_configuration_descriptor", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_descriptor_handlers", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_endpoint_descriptor_handlers", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_generate_configuration", "serial_usbipclient.tests.test_urb_packets.py.testurbpackets.test_interface_association_handlers"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""test exceptions are properly raised"""
2+
3+
from common_test_base import CommonTestBase
4+
from serial_usbipclient.usbip_client import USBIPValueError, USBIP_Connection
5+
6+
7+
class TestExceptions(CommonTestBase):
8+
"""tests exception throwing"""
9+
def test_endpoint_exceptions(self):
10+
"""test exceptions from endpoints"""
11+
conn: USBIP_Connection = USBIP_Connection()
12+
_ = conn.control # no exception
13+
14+
# exceptions should be thrown from uninitialized endpoints
15+
with self.assertRaisesRegex(expected_exception=USBIPValueError, expected_regex='no input endpoint!'):
16+
_ = conn.input
17+
18+
with self.assertRaisesRegex(expected_exception=USBIPValueError, expected_regex='no output endpoint!'):
19+
_ = conn.output
20+
21+
with self.assertRaisesRegex(expected_exception=USBIPValueError, expected_regex='no endpoint!'):
22+
_ = conn.pending_reads

0 commit comments

Comments
 (0)