Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat: add support for environment variables
The observer's position and timezone can now be set using the following environment variables: - `KOSMORRO_LATITUDE`: the observer's latitude - `KOSMORRO_LONGITUDE`: the observer's longitude - `KOSMORRO_TIMEZONE`: the observer's timezone
- Loading branch information
Jérôme Deuchnord
committed
Mar 25, 2020
1 parent
a0a7ffb
commit 5dec0dc
Showing
7 changed files
with
126 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,32 @@ | ||
import unittest | ||
|
||
import os | ||
import kosmorrolib.core as core | ||
|
||
|
||
class CoreTestCase(unittest.TestCase): | ||
def test_flatten_list(self): | ||
self.assertEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], core.flatten_list([0, 1, 2, [3, 4, [5, 6], 7], 8, [9]])) | ||
|
||
def test_get_env(self): | ||
self.assertEqual(0, len(core.get_env())) | ||
|
||
os.environ['SOME_RANDOM_VAR'] = 'an awesome value' | ||
self.assertEqual(0, len(core.get_env())) | ||
|
||
os.environ['KOSMORRO_GREAT_VARIABLE'] = 'value' | ||
env = core.get_env() | ||
self.assertEqual(1, len(env)) | ||
self.assertEqual('value', env.great_variable) | ||
|
||
os.environ['KOSMORRO_ANOTHER_VARIABLE'] = 'another value' | ||
env = core.get_env() | ||
self.assertEqual(2, len(env)) | ||
self.assertEqual('value', env.great_variable) | ||
self.assertEqual('another value', env.another_variable) | ||
|
||
self.assertEqual("{'great_variable': 'value', 'another_variable': 'another value'}", str(env)) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |