Skip to content

Commit 0144516

Browse files
committed
Rewrite tests to use b2sdk.utils.TempDir
1 parent 9a159ac commit 0144516

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/v1/test_account_info.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import platform
1818
import tempfile
1919

20+
from b2sdk.utils import TempDir
2021
import six
2122

2223
from .test_base import TestBase
@@ -309,21 +310,23 @@ def test_account_info_persistence(self):
309310
self._test_account_info(check_persistence=True)
310311

311312
def test_uses_xdg_config_home(self):
312-
with tempfile.TemporaryDirectory() as d:
313+
with TempDir() as d:
313314
account_info = self._make_sqlite_account_info(env={'XDG_CONFIG_HOME': d})
314315
expected_path = os.path.abspath(os.path.join(d, 'b2', 'account_info'))
315316
actual_path = os.path.abspath(account_info.filename)
316-
assert expected_path == actual_path, 'Actual path %s is not equal to $XDG_CONFIG_HOME/b2/account_info' % (actual_path,)
317+
assert expected_path == actual_path, 'Actual path %s is not equal to $XDG_CONFIG_HOME/b2/account_info' % (
318+
actual_path,
319+
)
317320
assert os.path.exists(
318321
os.path.join(d, 'b2')
319322
), 'Config folder $XDG_CONFIG_HOME/b2 was not created!'
320323

321324
def test_account_info_env_var_overrides_xdg_config_home(self):
322-
with tempfile.TemporaryDirectory() as d:
325+
with TempDir() as d:
323326
account_info = self._make_sqlite_account_info(
324327
env={
325328
'XDG_CONFIG_HOME': d,
326-
B2_ACCOUNT_INFO_ENV_VAR: os.path.join(d, 'b2_account_info')
329+
B2_ACCOUNT_INFO_ENV_VAR: os.path.join(d, 'b2_account_info'),
327330
}
328331
)
329332
expected_path = os.path.abspath(os.path.join(d, 'b2_account_info'))

0 commit comments

Comments
 (0)