Skip to content

Commit

Permalink
Merge #537
Browse files Browse the repository at this point in the history
537: tests: add a test for clear on message based resources r=MatthieuDartiailh a=MatthieuDartiailh

- [x] Executed ``black . && isort -c . && flake8`` with no errors


Co-authored-by: MatthieuDartiailh <marul@laposte.net>
  • Loading branch information
bors[bot] and MatthieuDartiailh committed Aug 26, 2020
2 parents 8481c5c + 5c44fa9 commit 8688eff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ steps:
echo Install pytest and co
pip install pytest pytest-azurepipelines pytest-cov
echo Run pytest
python -X dev -m pytest --pyargs pyvisa --cov pyvisa --cov-report xml
python -X dev -m pytest --pyargs pyvisa --cov pyvisa --cov-report xml -v
displayName: 'Run tests'

- script: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ def test_write_raw_read_raw(self):
self.instr.write_raw(b"SEND\n")
assert self.instr.read_raw(size=2) == b"test\n"

def test_clear(self):
"""Test clearing the incoming buffer.
"""
self.instr.write_raw(b"RECEIVE\n")
self.instr.write_raw(b"test\n")
self.instr.write_raw(b"SEND\n")
self.instr.clear()
self.instr.timeout = 10
with pytest.raises(errors.VisaIOError):
self.instr.read_raw()

def test_write_read(self):
"""Test writing and reading.
Expand Down

0 comments on commit 8688eff

Please sign in to comment.