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