use tmp_path instead of tmpdir

This commit is contained in:
Matthias
2023-11-05 16:25:36 +01:00
parent 5a3839320d
commit 6ea353447e
2 changed files with 10 additions and 10 deletions

View File

@@ -1512,10 +1512,10 @@ def test_backtesting_show(mocker, testdatadir, capsys):
assert "Pairs for Strategy" in out
def test_start_convert_db(mocker, fee, tmpdir, caplog):
db_src_file = Path(f"{tmpdir}/db.sqlite")
def test_start_convert_db(fee, tmp_path):
db_src_file = tmp_path / "db.sqlite"
db_from = f"sqlite:///{db_src_file}"
db_target_file = Path(f"{tmpdir}/db_target.sqlite")
db_target_file = tmp_path / "/db_target.sqlite"
db_to = f"sqlite:///{db_target_file}"
args = [
"convert-db",
@@ -1542,13 +1542,13 @@ def test_start_convert_db(mocker, fee, tmpdir, caplog):
assert db_target_file.is_file()
def test_start_strategy_updater(mocker, tmpdir):
def test_start_strategy_updater(mocker, tmp_path):
sc_mock = mocker.patch('freqtrade.commands.strategy_utils_commands.start_conversion')
teststrats = Path(__file__).parent.parent / 'strategy/strats'
args = [
"strategy-updater",
"--userdir",
str(tmpdir),
str(tmp_path),
"--strategy-path",
str(teststrats),
]
@@ -1562,7 +1562,7 @@ def test_start_strategy_updater(mocker, tmpdir):
args = [
"strategy-updater",
"--userdir",
str(tmpdir),
str(tmp_path),
"--strategy-path",
str(teststrats),
"--strategy-list",

View File

@@ -29,15 +29,15 @@ def test_init_create_session(default_conf):
assert 'scoped_session' in type(Trade.session).__name__
def test_init_custom_db_url(default_conf, tmpdir):
def test_init_custom_db_url(default_conf, tmp_path):
# Update path to a value other than default, but still in-memory
filename = f"{tmpdir}/freqtrade2_test.sqlite"
assert not Path(filename).is_file()
filename = tmp_path / "freqtrade2_test.sqlite"
assert not filename.is_file()
default_conf.update({'db_url': f'sqlite:///{filename}'})
init_db(default_conf['db_url'])
assert Path(filename).is_file()
assert filename.is_file()
r = Trade.session.execute(text("PRAGMA journal_mode"))
assert r.first() == ('wal',)