Skip to content

Commit

Permalink
Always use tmp path for clobber tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdangerx committed Nov 13, 2023
1 parent 6ea776e commit eac7dbe
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit eac7dbe

Please sign in to comment.