diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e8a59b0..2a8c516 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -37,4 +37,4 @@ jobs: mypy copley - name: Pytest run: | - pytest copley + pytest tests diff --git a/copley/mock.py b/copley/mock.py index 3d2777d..26552fd 100644 --- a/copley/mock.py +++ b/copley/mock.py @@ -23,22 +23,29 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.hw = AsyncClientMock() - async def _parse(self, command): - """Return mock requests to parsing.""" + async def query(self, command): + """Return mock requests to query.""" if not self.lock: self.lock = asyncio.Lock() async with self.lock: # lock releases on CancelledError if command == self.PRINT_REPORT: - return { - 'serial_number': 12345, - 'calc_type': "Fixed weight", - 'set_speed': "300", - 'total_taps': 1250, - 'sample_weight': "2.77", - 'init_volume': "170.0", - 'final_volume': "155.0", - 'bulk_density': "0.016", - 'tapped_density': "0.018", - 'hausner_ratio': "1.097", - 'compress_index': "8.82" - } + return 'hello world :)' + + def _parse(self, response): + """Return mock requests to parsing.""" + if response is None: + return {'on': False} + else: + return { + 'serial_number': 12345, + 'calc_type': "Fixed weight", + 'set_speed': "300", + 'total_taps': 1250, + 'sample_weight': "2.77", + 'init_volume': "170.0", + 'final_volume': "155.0", + 'bulk_density': "0.016", + 'tapped_density': "0.018", + 'hausner_ratio': "1.097", + 'compress_index': "8.82" + } diff --git a/setup.cfg b/setup.cfg index 969f572..a58a383 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ add_ignore = D104,D107 [tool:pytest] asyncio_mode = auto -addopts = --cov=ika +addopts = --cov=copley [tool:ruff] target-version = "py38" diff --git a/tests/test_driver.py b/tests/test_driver.py index bd5f132..7239e1d 100644 --- a/tests/test_driver.py +++ b/tests/test_driver.py @@ -15,7 +15,6 @@ def driver(): return TapDensity(ADDRESS) -@mock.patch('copley.TapDensity.query') @mock.patch('copley.TapDensity', TapDensity) def test_driver_cli(capsys): """Confirm the commandline interface works."""