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

Rework config fixtures #4906

Merged
merged 15 commits into from
Oct 2, 2023
Merged

Conversation

jenshnielsen
Copy link
Collaborator

@jenshnielsen jenshnielsen commented Jan 8, 2023

Replace existing config fixtures with 2 auto use fixtures.

  • A session fixture that makes sure that we load the default config and do not read / write config from any user folder. This makes sure that we dont fail tests due to config changes of the user or modify user configs. Also let this handle setting changes that we want to be different from the default. Disable telemetry, disable subscribers, set db path to a non existing file so test can't write to the default db if not using dataset / experiment fixtures.
  • A function fixture that resets any modification that a test has made to the config, closes any instruments and resets the default station

Since these are auto use we can remove all explicit use of config fixtures.

In the process fix some issues.

  • The old default_config fixture would replace qc.config with a new config object. This however will not work if the test had already imported the config object as from qcodes import config so instead patch the existing config object.
  • some dond tests were not correctly using the experiment fixture. This is also fixed.
  • remove deprecated function
  • config tests no longer needs to be skipped when running from user home as we patch the location of user home automatically before the test runs
  • Fix some logging tests that were leaking state or depending on leaked state

@jenshnielsen jenshnielsen force-pushed the always_set_config branch 2 times, most recently from d4c89e8 to c700045 Compare January 9, 2023 10:20
@codecov
Copy link

codecov bot commented Sep 24, 2023

Codecov Report

Merging #4906 (3d69c69) into master (c7cce2e) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #4906   +/-   ##
=======================================
  Coverage   68.24%   68.24%           
=======================================
  Files         341      341           
  Lines       29901    29901           
=======================================
  Hits        20405    20405           
  Misses       9496     9496           

@jenshnielsen jenshnielsen force-pushed the always_set_config branch 3 times, most recently from 416c4be to ff81995 Compare September 30, 2023 05:17
@jenshnielsen jenshnielsen marked this pull request as ready for review September 30, 2023 05:18
@jenshnielsen jenshnielsen changed the title Always set default config in the tests Always reset config on exit of tests Sep 30, 2023
@jenshnielsen jenshnielsen changed the title Always reset config on exit of tests Rework config fixtures Sep 30, 2023
@jenshnielsen jenshnielsen added this pull request to the merge queue Oct 2, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 2, 2023
@jenshnielsen jenshnielsen added this pull request to the merge queue Oct 2, 2023
Merged via the queue into microsoft:master with commit fbea1a3 Oct 2, 2023
@jenshnielsen jenshnielsen deleted the always_set_config branch October 2, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants