Skip to content

Commit 2731572

Browse files
author
Alex Meadows
committed
process_tracker_python-100 Add source/source object character set
🐛 Fixed issue where file path for config file was not setting correctly Issue was found where if the config file was named anything but 'process_tracker_config.ini' it would try to append that to the end. Have added a new filter to ensure that any file that ends with '.ini' can be accepted.
1 parent 19669af commit 2731572

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ after_success:
1414
before_script:
1515
- mkdir $HOME/.process_tracker
1616
- if [[ ! -z "$DB" ]]; then mv configs/${DB}_config.ini $HOME/.process_tracker/process_tracker_config.ini; fi
17+
- mv configs/process_tracker_config_dev.ini $HOME/.process_tracker/process_tracker_config_dev.ini
1718
- if [[ "$DB" == "postgres" ]]; then psql -f dbscripts/postgresql_account_create.sql -U postgres; fi
1819
- if [[ "$DB" == "postgres" ]]; then psql -f dbscripts/postgresql_process_tracker.sql process_tracker -U postgres; fi
1920
- if [[ "$DB" == "postgres" ]]; then psql -f dbscripts/postgresql_process_tracker_defaults.sql process_tracker -U postgres; fi

configs/process_tracker_config_dev.ini

Whitespace-only changes.

process_tracker/utilities/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ def __init__(self, config_location=None):
4040
else:
4141
self.config_path = config_location
4242

43-
if "process_tracker_config.ini" not in self.config_path:
43+
if (
44+
"process_tracker_config.ini" not in self.config_path
45+
and ".ini" not in self.config_path
46+
):
4447
self.logger.debug(
4548
"process_tracker_config.ini not present. Appending to %s"
4649
% self.config_path

tests/utilities/test_settings_manager.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ def test_config_location_set_with_file(self):
5656

5757
self.assertEqual(expected_result, given_result)
5858

59+
def test_config_location_set_with_ini_file(self):
60+
"""
61+
Testing that if an .ini file that is NOT named process_tracker_config.ini_in the config_location, it is accepted
62+
as the config file.
63+
:return:
64+
"""
65+
66+
expected_result = "/tmp/testing/process_tracker_config_dev.ini"
67+
68+
given_result = SettingsManager(
69+
config_location="/tmp/testing/process_tracker_config_dev.ini"
70+
).config_file
71+
72+
self.assertEqual(expected_result, given_result)
73+
5974
def test_config_location_s3(self):
6075
"""
6176
Testing that if config_location is set and the path is an s3 file/location, use that instead of the home

0 commit comments

Comments
 (0)