Skip to content

Commit ac0836e

Browse files
committed
improve naming and use returned path
1 parent 3bc3a2d commit ac0836e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

tests/support/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from unittest import TestCase, main as testmain
4242

4343
from tests.support.configsupp import FakeConfiguration
44-
from tests.support.picklesupp import ensure_path_within_output_dir, \
44+
from tests.support.picklesupp import verify_path_within_output_dir_and_return, \
4545
is_path_within
4646
from tests.support.suppconst import MIG_BASE, TEST_BASE, TEST_FIXTURE_DIR, \
4747
TEST_DATA_DIR, TEST_OUTPUT_DIR, ENVHELP_OUTPUT_DIR
@@ -391,7 +391,7 @@ def temppath(relative_path, test_case, ensure_dir=False, skip_clean=False):
391391
"""
392392
assert isinstance(test_case, MigTestCase)
393393

394-
tmp_path = ensure_path_within_output_dir(relative_path)
394+
tmp_path = verify_path_within_output_dir_and_return(relative_path)
395395

396396
if ensure_dir:
397397
try:

tests/support/_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def is_path_within(path, start=None, _msg=None):
1313
return not relative.startswith('..')
1414

1515

16-
def ensure_path_within_output_dir(relative_path):
16+
def verify_path_within_output_dir_and_return(relative_path):
1717
if os.path.isabs(relative_path):
1818
# the only permitted paths are those within the output directory set
1919
# aside for execution of the test suite: this will be enforced below

tests/support/picklesupp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import pickle
22

3-
from tests.support._path import ensure_path_within_output_dir, \
3+
from tests.support._path import verify_path_within_output_dir_and_return, \
44
is_path_within
55

66

77
class PickleAssertMixin:
88
def assertPickledFile(self, pickle_file):
9-
ensure_path_within_output_dir(pickle_file)
9+
tmp_path = verify_path_within_output_dir_and_return(pickle_file)
1010

11-
with open(pickle_file, 'rb') as picklefile:
11+
with open(tmp_path, 'rb') as picklefile:
1212
return pickle.load(picklefile)

0 commit comments

Comments
 (0)