summaryrefslogtreecommitdiff
path: root/tests/unit/config/config_test.py
diff options
context:
space:
mode:
authoralexrecuenco <alejandrogonzalezrecuenco@gmail.com>2020-02-24 13:24:57 +0100
committeralexrecuenco <safale93@gmail.com>2020-08-11 17:45:13 +0700
commit4d3d9f64b965af66662a934fc07af430e83ce524 (patch)
tree2583a452fe4fb13dbf3a2888f9d2bf30acaeeed3 /tests/unit/config/config_test.py
parent32a5ea5ac85cdba7a08ac28b999ff402f6f4c316 (diff)
Removed Python2 support
Closes: #6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <alejandrogonzalezrecuenco@gmail.com>
Diffstat (limited to 'tests/unit/config/config_test.py')
-rw-r--r--tests/unit/config/config_test.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/unit/config/config_test.py b/tests/unit/config/config_test.py
index f562141d..03e95f77 100644
--- a/tests/unit/config/config_test.py
+++ b/tests/unit/config/config_test.py
@@ -1,4 +1,3 @@
-# encoding: utf-8
import codecs
import os
import shutil
@@ -3885,12 +3884,12 @@ class VolumeConfigTest(unittest.TestCase):
assert d['volumes'] == ['~:/data']
def test_volume_path_with_non_ascii_directory(self):
- volume = u'/Füü/data:/data'
+ volume = '/Füü/data:/data'
container_path = config.resolve_volume_path(".", volume)
assert container_path == volume
-class MergePathMappingTest(object):
+class MergePathMappingTest:
config_name = ""
def test_empty(self):
@@ -3963,7 +3962,7 @@ class BuildOrImageMergeTest(unittest.TestCase):
assert config.merge_service_dicts({'image': 'redis'}, {'build': '.'}, V1) == {'build': '.'}
-class MergeListsTest(object):
+class MergeListsTest:
config_name = ""
base_config = []
override_config = []
@@ -4396,7 +4395,7 @@ class EnvTest(unittest.TestCase):
{'env_file': ['tests/fixtures/env/resolve.env']},
Environment.from_env_file(None)
) == {
- 'FILE_DEF': u'bär',
+ 'FILE_DEF': 'bär',
'FILE_DEF_EMPTY': '',
'ENV_DEF': 'E3',
'NO_DEF': None
@@ -5042,14 +5041,14 @@ class VolumePathTest(unittest.TestCase):
container_path = 'c:\\scarletdevil\\data'
expected_mapping = (container_path, (host_path, None))
- mapping = config.split_path_mapping('{0}:{1}'.format(host_path, container_path))
+ mapping = config.split_path_mapping('{}:{}'.format(host_path, container_path))
assert mapping == expected_mapping
def test_split_path_mapping_with_root_mount(self):
host_path = '/'
container_path = '/var/hostroot'
expected_mapping = (container_path, (host_path, None))
- mapping = config.split_path_mapping('{0}:{1}'.format(host_path, container_path))
+ mapping = config.split_path_mapping('{}:{}'.format(host_path, container_path))
assert mapping == expected_mapping