##// END OF EJS Templates
core: dropped configobj package use
super-admin -
r1065:a5957a43 python3
parent child Browse files
Show More
@@ -1,57 +1,55 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
9 dogpile.cache==1.1.8
7 dogpile.cache==1.1.8
10 decorator==5.1.1
8 decorator==5.1.1
11 stevedore==5.0.0
9 stevedore==5.0.0
12 pbr==5.11.1
10 pbr==5.11.1
13 dulwich==0.21.3
11 dulwich==0.21.3
14 urllib3==1.26.14
12 urllib3==1.26.14
15 gunicorn==20.1.0
13 gunicorn==20.1.0
16 hg-evolve==11.0.0
14 hg-evolve==11.0.0
17 importlib-metadata==6.0.0
15 importlib-metadata==6.0.0
18 zipp==3.15.0
16 zipp==3.15.0
19 mercurial==6.3.3
17 mercurial==6.3.3
20 mock==5.0.1
18 mock==5.0.1
21 more-itertools==9.1.0
19 more-itertools==9.1.0
22 msgpack-python==0.5.6
20 msgpack-python==0.5.6
23 pathlib2==2.3.7.post1
21 pathlib2==2.3.7.post1
24 six==1.16.0
22 six==1.16.0
25 psutil==5.9.4
23 psutil==5.9.4
26 py==1.11.0
24 py==1.11.0
27 pygit2==1.11.1
25 pygit2==1.11.1
28 cffi==1.15.1
26 cffi==1.15.1
29 pycparser==2.21
27 pycparser==2.21
30 pygments==2.14.0
28 pygments==2.14.0
31 pyparsing==3.0.9
29 pyparsing==3.0.9
32 pyramid==2.0.1
30 pyramid==2.0.1
33 hupper==1.11
31 hupper==1.11
34 plaster==1.1.2
32 plaster==1.1.2
35 plaster-pastedeploy==1.0.1
33 plaster-pastedeploy==1.0.1
36 pastedeploy==3.0.1
34 pastedeploy==3.0.1
37 plaster==1.1.2
35 plaster==1.1.2
38 translationstring==1.4
36 translationstring==1.4
39 venusian==3.0.0
37 venusian==3.0.0
40 webob==1.8.7
38 webob==1.8.7
41 zope.deprecation==4.4.0
39 zope.deprecation==4.4.0
42 zope.interface==5.5.2
40 zope.interface==5.5.2
43 redis==4.5.1
41 redis==4.5.1
44 async-timeout==4.0.2
42 async-timeout==4.0.2
45 repoze.lru==0.7
43 repoze.lru==0.7
46 scandir==1.10.0
44 scandir==1.10.0
47 setproctitle==1.3.2
45 setproctitle==1.3.2
48 simplejson==3.18.3
46 simplejson==3.18.3
49 subvertpy==0.11.0
47 subvertpy==0.11.0
50 wcwidth==0.2.6
48 wcwidth==0.2.6
51
49
52
50
53 ## test related requirements
51 ## test related requirements
54 -r requirements_test.txt
52 -r requirements_test.txt
55
53
56 ## uncomment to add the debug libraries
54 ## uncomment to add the debug libraries
57 #-r requirements_debug.txt
55 #-r requirements_debug.txt
@@ -1,86 +1,85 b''
1 # RhodeCode VCSServer provides access to different vcs backends via network.
1 # RhodeCode VCSServer provides access to different vcs backends via network.
2 # Copyright (C) 2014-2020 RhodeCode GmbH
2 # Copyright (C) 2014-2020 RhodeCode GmbH
3 #
3 #
4 # This program is free software; you can redistribute it and/or modify
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
7 # (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
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):
26 """
25 """
27 Allows to create a new test.ini file as a copy of existing one with edited
26 Allows to create a new test.ini file as a copy of existing one with edited
28 data. If existing file is not present, it creates a new one. Example usage::
27 data. If existing file is not present, it creates a new one. Example usage::
29
28
30 with TestINI('test.ini', [{'section': {'key': 'val'}}]) as new_test_ini_path:
29 with TestINI('test.ini', [{'section': {'key': 'val'}}]) as new_test_ini_path:
31 print 'vcsserver --config=%s' % new_test_ini
30 print 'vcsserver --config=%s' % new_test_ini
32 """
31 """
33
32
34 def __init__(self, ini_file_path, ini_params, new_file_prefix=None,
33 def __init__(self, ini_file_path, ini_params, new_file_prefix=None,
35 destroy=True):
34 destroy=True):
36 self.ini_file_path = ini_file_path
35 self.ini_file_path = ini_file_path
37 self.ini_params = ini_params
36 self.ini_params = ini_params
38 self.new_path = None
37 self.new_path = None
39 self.new_path_prefix = new_file_prefix or 'test'
38 self.new_path_prefix = new_file_prefix or 'test'
40 self.destroy = destroy
39 self.destroy = destroy
41
40
42 def __enter__(self):
41 def __enter__(self):
43 _, pref = tempfile.mkstemp()
42 _, pref = tempfile.mkstemp()
44 loc = tempfile.gettempdir()
43 loc = tempfile.gettempdir()
45 self.new_path = os.path.join(loc, '{}_{}_{}'.format(
44 self.new_path = os.path.join(loc, '{}_{}_{}'.format(
46 pref, self.new_path_prefix, self.ini_file_path))
45 pref, self.new_path_prefix, self.ini_file_path))
47
46
48 # copy ini file and modify according to the params, if we re-use a file
47 # copy ini file and modify according to the params, if we re-use a file
49 if os.path.isfile(self.ini_file_path):
48 if os.path.isfile(self.ini_file_path):
50 shutil.copy(self.ini_file_path, self.new_path)
49 shutil.copy(self.ini_file_path, self.new_path)
51 else:
50 else:
52 # create new dump file for configObj to write to.
51 # create new dump file for configObj to write to.
53 with open(self.new_path, 'wb'):
52 with open(self.new_path, 'wb'):
54 pass
53 pass
55
54
56 config = configobj.ConfigObj(
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 config:
61 if section not in parser:
63 config[section] = {}
62 parser[section] = {}
64 config[section][key] = val
63 parser[section][key] = val
65
64 with open(self.ini_file_path, 'w') as f:
66 config.write()
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):
70 if self.destroy:
69 if self.destroy:
71 os.remove(self.new_path)
70 os.remove(self.new_path)
72
71
73
72
74 def no_newline_id_generator(test_name):
73 def no_newline_id_generator(test_name):
75 """
74 """
76 Generates a test name without spaces or newlines characters. Used for
75 Generates a test name without spaces or newlines characters. Used for
77 nicer output of progress of test
76 nicer output of progress of test
78 """
77 """
79 org_name = test_name
78 org_name = test_name
80 test_name = str(test_name)\
79 test_name = str(test_name)\
81 .replace('\n', '_N') \
80 .replace('\n', '_N') \
82 .replace('\r', '_N') \
81 .replace('\r', '_N') \
83 .replace('\t', '_T') \
82 .replace('\t', '_T') \
84 .replace(' ', '_S')
83 .replace(' ', '_S')
85
84
86 return test_name or 'test-with-empty-name'
85 return test_name or 'test-with-empty-name'
General Comments 0
You need to be logged in to leave comments. Login now