Skip to content

Commit 0be167c

Browse files
committed
process_tracker_python-71 Extract Location Names
✨ Location Names are now ensured to be unique (number added to end) 🐛 Paths that end in filename should now use parent directory for location name Closes #71
1 parent 8907b9b commit 0be167c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

process_tracker/location_tracker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ def derive_location_name(self):
5858
location_prefix = None
5959

6060
current_name = (
61-
self.session.query(Location.location_name)
61+
self.session.query(Location)
6262
.filter(Location.location_path == self.location_path)
6363
.first()
6464
)
6565

6666
if current_name is not None:
67-
location_name = current_name[0].location_name
67+
location_name = current_name.location_name
6868
else:
6969
location_name = ""
7070

tests/test_extract_tracker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def test_derive_location_name_local_path(self):
246246
)
247247

248248
given_result = location[0].location_name
249-
expected_result = "extract_dir2"
249+
expected_result = "local - extract_dir2"
250250

251251
self.assertEqual(expected_result, given_result)
252252

@@ -266,7 +266,7 @@ def test_derive_location_name_s3(self):
266266
)
267267

268268
given_result = location[0].location_name
269-
expected_result = "s3 - extract_dir"
269+
expected_result = "s3 test-test - extract_dir"
270270

271271
self.assertEqual(expected_result, given_result)
272272

0 commit comments

Comments
 (0)