Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Oct 20, 2023
1 parent 4359efd commit 9dd4234
Show file tree
Hide file tree
Showing 23 changed files with 43 additions and 45 deletions.
2 changes: 1 addition & 1 deletion tests/dataset/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import pytest

pytest.register_assert_rewrite('qcodes.tests.dataset.helper_functions')
pytest.register_assert_rewrite("tests.dataset.helper_functions")
2 changes: 1 addition & 1 deletion tests/dataset/dond/test_do0d.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Multi2DSetPointParam2Sizes,
MultiSetPointParam,
)
from qcodes.tests.dataset.conftest import ArrayshapedParam
from tests.dataset.conftest import ArrayshapedParam


@pytest.mark.usefixtures("plot_close", "experiment")
Expand Down
2 changes: 1 addition & 1 deletion tests/dataset/dond/test_do1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
MultiSetPointParam,
)
from qcodes.parameters import Parameter
from qcodes.tests.dataset.conftest import ArrayshapedParam
from tests.dataset.conftest import ArrayshapedParam


@pytest.mark.usefixtures("plot_close", "experiment")
Expand Down
2 changes: 1 addition & 1 deletion tests/dataset/dond/test_doNd.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
MultiSetPointParam,
)
from qcodes.parameters import ManualParameter, Parameter, ParameterBase
from qcodes.tests.dataset.conftest import ArrayshapedParam
from qcodes.validators import Ints
from tests.dataset.conftest import ArrayshapedParam


class TrackingParameter(Parameter):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from qcodes.dataset.sqlite.connection import atomic_transaction
from qcodes.parameters import ManualParameter, Parameter, expand_setpoints_helper
from qcodes.station import Station
from qcodes.tests.common import retry_until_does_not_throw
from tests.common import retry_until_does_not_throw


def test_log_messages(caplog: LogCaptureFixture, meas_with_registered_param) -> None:
Expand Down
8 changes: 4 additions & 4 deletions tests/dataset/test_database_creation_and_upgrading.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import qcodes as qc
import qcodes.dataset.descriptions.versioning.serialization as serial
import qcodes.tests.dataset
import tests.dataset
from qcodes.dataset import (
ConnectionPlus,
connect,
Expand Down Expand Up @@ -50,10 +50,10 @@
is_column_in_table,
one,
)
from qcodes.tests.common import error_caused_by, skip_if_no_fixtures
from qcodes.tests.dataset.conftest import temporarily_copied_DB
from tests.common import error_caused_by, skip_if_no_fixtures
from tests.dataset.conftest import temporarily_copied_DB

fixturepath = os.sep.join(qcodes.tests.dataset.__file__.split(os.sep)[:-1])
fixturepath = os.sep.join(tests.dataset.__file__.split(os.sep)[:-1])

Check notice on line 56 in tests/dataset/test_database_creation_and_upgrading.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/dataset/test_database_creation_and_upgrading.py#L56

Constant name "fixturepath" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern
fixturepath = os.path.join(fixturepath, 'fixtures')


Expand Down
6 changes: 3 additions & 3 deletions tests/dataset/test_database_extract_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from numpy.testing import assert_array_equal

import qcodes as qc
import qcodes.tests.dataset
import tests.dataset
from qcodes.dataset import do1d, do2d
from qcodes.dataset.data_set import (
DataSet,
Expand All @@ -35,7 +35,7 @@
from qcodes.dataset.sqlite.queries import get_experiments
from qcodes.instrument_drivers.instrument_mocks import DummyInstrument
from qcodes.station import Station
from qcodes.tests.common import error_caused_by, skip_if_no_fixtures
from tests.common import error_caused_by, skip_if_no_fixtures


@contextmanager
Expand Down Expand Up @@ -727,7 +727,7 @@ def test_old_versions_not_touched(

_, new_v = get_db_version_and_newest_available_version(source_path)

fixturepath = os.sep.join(qcodes.tests.dataset.__file__.split(os.sep)[:-1])
fixturepath = os.sep.join(tests.dataset.__file__.split(os.sep)[:-1])
fixturepath = os.path.join(fixturepath,
'fixtures', 'db_files', 'version2',
'some_runs.db')
Expand Down
6 changes: 3 additions & 3 deletions tests/dataset/test_dataset_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
from qcodes.dataset.sqlite.connection import atomic, path_to_dbfile
from qcodes.dataset.sqlite.database import _convert_array, get_DB_location
from qcodes.dataset.sqlite.queries import _rewrite_timestamps, _unicode_categories
from qcodes.tests.common import error_caused_by
from qcodes.tests.dataset.helper_functions import verify_data_dict
from qcodes.tests.dataset.test_links import generate_some_links
from qcodes.utils.types import complex_types, numpy_complex, numpy_floats, numpy_ints
from tests.common import error_caused_by
from tests.dataset.helper_functions import verify_data_dict
from tests.dataset.test_links import generate_some_links

n_experiments = 0

Expand Down
2 changes: 1 addition & 1 deletion tests/dataset/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from qcodes.dataset.descriptions.param_spec import ParamSpec, ParamSpecBase
from qcodes.dataset.descriptions.versioning.converters import new_to_old, old_to_new
from qcodes.dataset.descriptions.versioning.v0 import InterDependencies
from qcodes.tests.common import error_caused_by
from tests.common import error_caused_by


def test_wrong_input_raises() -> None:
Expand Down
8 changes: 4 additions & 4 deletions tests/dataset/test_fix_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import qcodes.dataset.descriptions.versioning.serialization as serial
import qcodes.dataset.descriptions.versioning.v0 as v0
import qcodes.tests.dataset
import tests.dataset
from qcodes.dataset.database_fix_functions import (
fix_version_4a_run_description_bug,
fix_wrong_run_descriptions,
Expand All @@ -15,10 +15,10 @@
from qcodes.dataset.descriptions.versioning.converters import old_to_new
from qcodes.dataset.sqlite.db_upgrades.version import get_user_version
from qcodes.dataset.sqlite.queries import get_run_description
from qcodes.tests.common import skip_if_no_fixtures
from qcodes.tests.dataset.conftest import temporarily_copied_DB
from tests.common import skip_if_no_fixtures
from tests.dataset.conftest import temporarily_copied_DB

fixturepath = os.sep.join(qcodes.tests.dataset.__file__.split(os.sep)[:-1])
fixturepath = os.sep.join(tests.dataset.__file__.split(os.sep)[:-1])

Check notice on line 21 in tests/dataset/test_fix_functions.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

tests/dataset/test_fix_functions.py#L21

Constant name "fixturepath" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern
fixturepath = os.path.join(fixturepath, 'fixtures')


Expand Down
2 changes: 1 addition & 1 deletion tests/dataset/test_nested_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from qcodes.dataset.descriptions.dependencies import InterDependencies_
from qcodes.dataset.descriptions.param_spec import ParamSpecBase
from qcodes.dataset.sqlite.connection import atomic_transaction
from qcodes.tests.common import retry_until_does_not_throw
from tests.common import retry_until_does_not_throw

VALUE = Union[str, float, list, np.ndarray, bool]

Expand Down
2 changes: 1 addition & 1 deletion tests/dataset/test_sqlite_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
from qcodes.dataset.sqlite import query_helpers as mut_help
from qcodes.dataset.sqlite.connection import atomic_transaction, path_to_dbfile
from qcodes.dataset.sqlite.database import get_DB_location
from qcodes.tests.common import error_caused_by
from qcodes.utils import QCoDeSDeprecationWarning
from tests.common import error_caused_by

from .helper_functions import verify_data_dict

Expand Down
2 changes: 1 addition & 1 deletion tests/dataset/test_sqlite_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
make_connection_plus_from,
)
from qcodes.dataset.sqlite.database import connect
from qcodes.tests.common import error_caused_by
from tests.common import error_caused_by


def sqlite_conn_in_transaction(conn: sqlite3.Connection):
Expand Down
6 changes: 3 additions & 3 deletions tests/dataset/test_subscribing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from qcodes.dataset.descriptions.dependencies import InterDependencies_
from qcodes.dataset.descriptions.param_spec import ParamSpecBase
from qcodes.dataset.sqlite.connection import atomic_transaction
from qcodes.tests.common import retry_until_does_not_throw
from tests.common import retry_until_does_not_throw

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -67,7 +67,7 @@ def _make_working_subscriber_config(tmp_path):
"subscription":{
"subscribers":{
"test_subscriber":{
"factory": "qcodes.tests.dataset.test_subscribing.MockSubscriber",
"factory": "tests.dataset.test_subscribing.MockSubscriber",
"factory_kwargs":{
"lg": false
},
Expand Down Expand Up @@ -96,7 +96,7 @@ def _make_broken_subscriber_config(tmp_path):
"subscription":{
"subscribers":{
"test_subscriber_wrong":{
"factory": "qcodes.tests.dataset.test_subscribing.MockSubscriber",
"factory": "tests.dataset.test_subscribing.MockSubscriber",
"factory_kwargs":{
"lg": false
},
Expand Down
2 changes: 1 addition & 1 deletion tests/drivers/test_Agilent_E8257D.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qcodes.instrument_drivers.agilent import AgilentE8257D
from qcodes.tests.driver_test_case import DriverTestCase
from tests.driver_test_case import DriverTestCase


class TestAgilentE8257D(DriverTestCase):
Expand Down
7 changes: 3 additions & 4 deletions tests/drivers/test_lakeshore_335.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
import time

from qcodes.instrument import InstrumentBase
from qcodes.instrument_drivers.Lakeshore import LakeshoreModel335

from .test_lakeshore import (
from qcodes.instrument_drivers.instrument_mocks import instrument_fixture
from qcodes.instrument_drivers.instrument_mocks.lakeshore import (
DictClass,
MockVisaInstrument,
command,
instrument_fixture,
query,
split_args,
)
from qcodes.instrument_drivers.Lakeshore import LakeshoreModel335

log = logging.getLogger(__name__)

Expand Down
7 changes: 3 additions & 4 deletions tests/drivers/test_lakeshore_336.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
import time

from qcodes.instrument import InstrumentBase
from qcodes.instrument_drivers.Lakeshore import LakeshoreModel336

from .test_lakeshore import (
from qcodes.instrument_drivers.instrument_mocks import instrument_fixture
from qcodes.instrument_drivers.instrument_mocks.lakeshore import (
DictClass,
MockVisaInstrument,
command,
instrument_fixture,
query,
split_args,
)
from qcodes.instrument_drivers.Lakeshore import LakeshoreModel336

log = logging.getLogger(__name__)

Expand Down
7 changes: 3 additions & 4 deletions tests/drivers/test_lakeshore_336_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
import time

from qcodes.instrument import InstrumentBase
from qcodes.instrument_drivers.Lakeshore.Model_336 import Model_336

from .test_lakeshore import (
from qcodes.instrument_drivers.instrument_mocks import instrument_fixture
from qcodes.instrument_drivers.instrument_mocks.lakeshore import (
DictClass,
MockVisaInstrument,
command,
instrument_fixture,
query,
split_args,
)
from qcodes.instrument_drivers.Lakeshore.Model_336 import Model_336

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/drivers/test_tektronix_AWG70000A.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from lxml import etree
from pytest import LogCaptureFixture

import qcodes.tests.drivers.auxiliary_files as auxfiles
import tests.drivers.auxiliary_files as auxfiles
from qcodes.instrument_drivers.tektronix.AWG70000A import AWG70000A
from qcodes.instrument_drivers.tektronix.AWG70002A import AWG70002A

Expand Down
2 changes: 1 addition & 1 deletion tests/drivers/test_weinchel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from qcodes.instrument_drivers.weinschel import Weinschel8320
from qcodes.tests.driver_test_case import DriverTestCase
from tests.driver_test_case import DriverTestCase


class TestWeinschel8320(DriverTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/test_compare_dictionaries.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pytest

from qcodes.tests.common import compare_dictionaries
from tests.common import compare_dictionaries


def test_same() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class GammyInstrument(Instrument):
error_msg = (
"Instrument instr is <class "
"'qcodes.instrument_drivers.instrument_mocks.DummyInstrument'> but "
"<class 'qcodes.tests.test_instrument"
"<class 'tests.test_instrument"
".test_find_same_name_but_different_class.<locals>"
".GammyInstrument'> was requested"
)
Expand Down
5 changes: 3 additions & 2 deletions tests/test_station.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,9 @@ def test_able_to_load_instrument_with_name_argument_not_being_the_first() -> Non
"""
instruments:
name_goes_second:
type: qcodes.tests.test_station.InstrumentWithNameAsNotFirstArgument
""")
type: tests.test_station.InstrumentWithNameAsNotFirstArgument
"""
)

instr = st.load_instrument('name_goes_second', first_arg=42)
assert isinstance(instr, InstrumentWithNameAsNotFirstArgument)
Expand Down

0 comments on commit 9dd4234

Please sign in to comment.