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

Always use tmp path for clobber tests. #3043

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions test/unit/extract/xbrl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,16 @@ def test_xbrl2sqlite_db_exists_no_clobber(mocker):
xbrl2sqlite(context)


def test_xbrl2sqlite_db_exists_yes_clobber(mocker):
def test_xbrl2sqlite_db_exists_yes_clobber(mocker, tmp_path):
convert_form_mock = mocker.MagicMock()
mocker.patch("pudl.extract.xbrl.convert_form", new=convert_form_mock)

# Mock datastore object to allow comparison
mock_datastore = mocker.MagicMock()
mocker.patch("pudl.extract.xbrl.FercXbrlDatastore", return_value=mock_datastore)

ferc1_sqlite_path = PudlPaths().output_dir / "ferc1_xbrl.sqlite"
# always use tmp path here so that we don't clobber the live DB when --live-dbs is passed
ferc1_sqlite_path = tmp_path / "ferc1_xbrl.sqlite"
ferc1_sqlite_path.touch()

# mock the db path so we can assert it gets clobbered
Expand Down