From f0a07b7e81636d5e49a8e38dedf91bfadc8e00cd Mon Sep 17 00:00:00 2001 From: Hernan Grecco Date: Mon, 6 Jan 2014 20:16:56 -0300 Subject: [PATCH] Moved tests to examples See #13 --- pyvisa/testsuite/test_itc4.py => examples/itc4.py | 6 +++--- .../test_keithley2000.py => examples/keithley2000.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) rename pyvisa/testsuite/test_itc4.py => examples/itc4.py (91%) rename pyvisa/testsuite/test_keithley2000.py => examples/keithley2000.py (88%) diff --git a/pyvisa/testsuite/test_itc4.py b/examples/itc4.py similarity index 91% rename from pyvisa/testsuite/test_itc4.py rename to examples/itc4.py index 9911b346..bd6e7cba 100644 --- a/pyvisa/testsuite/test_itc4.py +++ b/examples/itc4.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# test_itc4.py - PyVISA test code for Oxfort ITC4 temperature controller +# itc4.py - PyVISA test code for Oxfort ITC4 temperature controller # # Copyright © 2005, 2006, 2007, 2008 # Torsten Bronger , @@ -33,11 +33,11 @@ from __future__ import division, unicode_literals, print_function, absolute_import -from visa import * +import visa def test_itc4(): print("Test start") - itc4 = Instrument("COM2", term_chars = b"\r", timeout = 5) + itc4 = visa.Instrument("COM2", term_chars=b"\r", timeout=5) itc4.write(b"V") print(itc4.read()) print("Test end") diff --git a/pyvisa/testsuite/test_keithley2000.py b/examples/keithley2000.py similarity index 88% rename from pyvisa/testsuite/test_keithley2000.py rename to examples/keithley2000.py index 21e63a68..aeea199d 100644 --- a/pyvisa/testsuite/test_keithley2000.py +++ b/examples/keithley2000.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# test_keithley2000.py - PyVISA test code for Keithley 2000 multimeter +# keithley2000.py - PyVISA test code for Keithley 2000 multimeter # # Copyright © 2005, 2006, 2007, 2008 # Torsten Bronger , @@ -33,13 +33,13 @@ from __future__ import division, unicode_literals, print_function, absolute_import -from visa import * +import visa def test_keithley2000(monkeypatch): - monkeypatch.setattr(GpibInstrument, 'interface_type', VI_INTF_GPIB) - monkeypatch.setattr(GpibInstrument, 'stb', 0x40) + monkeypatch.setattr(visa.GpibInstrument, 'interface_type', VI_INTF_GPIB) + monkeypatch.setattr(visa.GpibInstrument, 'stb', 0x40) print("Test start") - keithley = GpibInstrument(12) + keithley = visa.GpibInstrument(12) milliseconds = 500 number_of_values = 10 keithley.write(("F0B2M2G0T2Q%dI%dX" % (milliseconds, number_of_values)).encode('ascii'))