Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed NotImplementedError when calling the clear() method #50

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pyvisa-sim/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,7 @@ def disable_event(self, session, event_type, mechanism):
def discard_events(self, session, event_type, mechanism):
# TODO: implement this for GPIB finalization
pass

def clear(self, session):
# Override to prevent the base class from raising a NotImplementedError
pass
11 changes: 11 additions & 0 deletions pyvisa-sim/testsuite/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ def test_list(resource_manager):
}


@pytest.mark.parametrize('resource', [
'ASRL1::INSTR',
])
def test_clear(resource, resource_manager):
inst = resource_manager.open_resource(resource, read_termination='\n',
write_termination='\r\n' if resource.startswith('ASRL') else '\n')

inst.clear()
inst.close()


@pytest.mark.parametrize('resource', [
'ASRL1::INSTR',
'GPIB0::8::0::INSTR',
Expand Down