use tmp_path instead of tmpdir
This commit is contained in:
@@ -1512,10 +1512,10 @@ def test_backtesting_show(mocker, testdatadir, capsys):
|
|||||||
assert "Pairs for Strategy" in out
|
assert "Pairs for Strategy" in out
|
||||||
|
|
||||||
|
|
||||||
def test_start_convert_db(mocker, fee, tmpdir, caplog):
|
def test_start_convert_db(fee, tmp_path):
|
||||||
db_src_file = Path(f"{tmpdir}/db.sqlite")
|
db_src_file = tmp_path / "db.sqlite"
|
||||||
db_from = f"sqlite:///{db_src_file}"
|
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}"
|
db_to = f"sqlite:///{db_target_file}"
|
||||||
args = [
|
args = [
|
||||||
"convert-db",
|
"convert-db",
|
||||||
@@ -1542,13 +1542,13 @@ def test_start_convert_db(mocker, fee, tmpdir, caplog):
|
|||||||
assert db_target_file.is_file()
|
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')
|
sc_mock = mocker.patch('freqtrade.commands.strategy_utils_commands.start_conversion')
|
||||||
teststrats = Path(__file__).parent.parent / 'strategy/strats'
|
teststrats = Path(__file__).parent.parent / 'strategy/strats'
|
||||||
args = [
|
args = [
|
||||||
"strategy-updater",
|
"strategy-updater",
|
||||||
"--userdir",
|
"--userdir",
|
||||||
str(tmpdir),
|
str(tmp_path),
|
||||||
"--strategy-path",
|
"--strategy-path",
|
||||||
str(teststrats),
|
str(teststrats),
|
||||||
]
|
]
|
||||||
@@ -1562,7 +1562,7 @@ def test_start_strategy_updater(mocker, tmpdir):
|
|||||||
args = [
|
args = [
|
||||||
"strategy-updater",
|
"strategy-updater",
|
||||||
"--userdir",
|
"--userdir",
|
||||||
str(tmpdir),
|
str(tmp_path),
|
||||||
"--strategy-path",
|
"--strategy-path",
|
||||||
str(teststrats),
|
str(teststrats),
|
||||||
"--strategy-list",
|
"--strategy-list",
|
||||||
|
|||||||
@@ -29,15 +29,15 @@ def test_init_create_session(default_conf):
|
|||||||
assert 'scoped_session' in type(Trade.session).__name__
|
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
|
# Update path to a value other than default, but still in-memory
|
||||||
filename = f"{tmpdir}/freqtrade2_test.sqlite"
|
filename = tmp_path / "freqtrade2_test.sqlite"
|
||||||
assert not Path(filename).is_file()
|
assert not filename.is_file()
|
||||||
|
|
||||||
default_conf.update({'db_url': f'sqlite:///{filename}'})
|
default_conf.update({'db_url': f'sqlite:///{filename}'})
|
||||||
|
|
||||||
init_db(default_conf['db_url'])
|
init_db(default_conf['db_url'])
|
||||||
assert Path(filename).is_file()
|
assert filename.is_file()
|
||||||
r = Trade.session.execute(text("PRAGMA journal_mode"))
|
r = Trade.session.execute(text("PRAGMA journal_mode"))
|
||||||
assert r.first() == ('wal',)
|
assert r.first() == ('wal',)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user