Show More
@@ -1,8 +1,6 b'' | |||||
1 | # deps, generated via pipdeptree --exclude setuptools,wheel,pipdeptree,pip -f | tr '[:upper:]' '[:lower:]' |
|
1 | # deps, generated via pipdeptree --exclude setuptools,wheel,pipdeptree,pip -f | tr '[:upper:]' '[:lower:]' | |
2 |
|
2 | |||
3 | atomicwrites==1.4.1 |
|
3 | atomicwrites==1.4.1 | |
4 | configobj==5.0.8 |
|
|||
5 | six==1.16.0 |
|
|||
6 | contextlib2==21.6.0 |
|
4 | contextlib2==21.6.0 | |
7 | cov-core==1.15.0 |
|
5 | cov-core==1.15.0 | |
8 | coverage==7.2.1 |
|
6 | coverage==7.2.1 |
@@ -18,8 +18,7 b'' | |||||
18 | import os |
|
18 | import os | |
19 | import shutil |
|
19 | import shutil | |
20 | import tempfile |
|
20 | import tempfile | |
21 |
|
21 | import configparser | ||
22 | import configobj |
|
|||
23 |
|
22 | |||
24 |
|
23 | |||
25 | class ContextINI(object): |
|
24 | class ContextINI(object): | |
@@ -53,17 +52,17 b' class ContextINI(object):' | |||||
53 | with open(self.new_path, 'wb'): |
|
52 | with open(self.new_path, 'wb'): | |
54 | pass |
|
53 | pass | |
55 |
|
54 | |||
56 |
|
|
55 | parser = configparser.ConfigParser() | |
57 | self.new_path, file_error=True, write_empty_values=True) |
|
56 | parser.read(self.ini_file_path) | |
58 |
|
57 | |||
59 | for data in self.ini_params: |
|
58 | for data in self.ini_params: | |
60 | section, ini_params = list(data.items())[0] |
|
59 | section, ini_params = list(data.items())[0] | |
61 | key, val = list(ini_params.items())[0] |
|
60 | key, val = list(ini_params.items())[0] | |
62 |
if section not in |
|
61 | if section not in parser: | |
63 |
|
|
62 | parser[section] = {} | |
64 |
|
|
63 | parser[section][key] = val | |
65 |
|
64 | with open(self.ini_file_path, 'w') as f: | ||
66 |
|
|
65 | parser.write(f) | |
67 | return self.new_path |
|
66 | return self.new_path | |
68 |
|
67 | |||
69 | def __exit__(self, exc_type, exc_val, exc_tb): |
|
68 | def __exit__(self, exc_type, exc_val, exc_tb): |
General Comments 0
You need to be logged in to leave comments.
Login now