Skip to content

Commit d8d7f60

Browse files
committed
Merge pull request #60 from vrutkovs/py26
Support python 2.6
2 parents 3597be6 + 2047da3 commit d8d7f60

File tree

3 files changed

+51
-24
lines changed

3 files changed

+51
-24
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ sudo: false
33
language: python
44

55
python:
6+
- "2.6"
67
- "2.7"
78

89
env:
@@ -15,7 +16,7 @@ matrix:
1516
- env: TESTS="pep8"
1617

1718
before_install:
18-
- pip install pep8 pyflakes behave PyHamcrest python-coveralls nose --upgrade
19+
- pip install pep8 pyflakes importlib behave PyHamcrest python-coveralls nose --upgrade
1920
- python setup.py -q install
2021
- git clean -fdx
2122

ctf_cli/application.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,25 @@ def add_remote(self):
120120
self.add_remote_step()
121121

122122
def add_remote_feature(self):
123-
project = self._cli_conf.get(
124-
CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_REMOTE_PROJECT)
125-
if project is None:
126-
path = "tests/features/"
127-
else:
123+
path = "tests/features/"
124+
try:
125+
project = self._cli_conf.get(
126+
CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_REMOTE_PROJECT)
127+
assert project
128128
path = "tests/features/" + project
129+
except Exception:
130+
pass
129131
self.add_submodule(path)
130132

131133
def add_remote_step(self):
132-
project = self._cli_conf.get(
133-
CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_REMOTE_PROJECT)
134-
if project is None:
135-
path = "tests/steps/"
136-
else:
134+
path = "tests/steps/"
135+
try:
136+
project = self._cli_conf.get(
137+
CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_REMOTE_PROJECT)
138+
assert project
137139
path = "tests/steps/" + project
140+
except Exception:
141+
pass
138142
self.add_submodule(path)
139143

140144
def list_remotes(self):

ctf_cli/behave.py

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ def __init__(self, working_dir, cli_conf=None):
9090
self._features_dir = os.path.join(self._working_dir, 'features')
9191
self._steps_dir = os.path.join(self._working_dir, 'steps')
9292

93-
tests_conf_path = self._cli_conf.get(CTFCliConfig.GLOBAL_SECTION_NAME,
94-
CTFCliConfig.CONFIG_TESTS_CONFIG_PATH)
95-
if tests_conf_path is None:
96-
self._tests_conf_path = self.find_tests_config(self._project_tests_dir)
97-
else:
93+
self._tests_conf_path = self.find_tests_config(self._project_tests_dir)
94+
try:
95+
tests_conf_path = self._cli_conf.get(CTFCliConfig.GLOBAL_SECTION_NAME,
96+
CTFCliConfig.CONFIG_TESTS_CONFIG_PATH)
97+
assert tests_conf_path
9898
self._tests_conf_path = tests_conf_path
99+
except Exception:
100+
pass
99101

100102
if self._tests_conf_path is not None:
101103
# keep the cli_conf object Up-To-Date
@@ -321,17 +323,37 @@ def run(self):
321323
Run Behave and pass some runtime arguments
322324
:return:
323325
"""
326+
behave_data = None
327+
try:
328+
behave_data = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_BEHAVE_DATA)
329+
except Exception:
330+
pass
331+
332+
behave_tags = None
333+
try:
334+
behave_tags = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_BEHAVE_TAGS)
335+
except Exception:
336+
pass
324337

325-
behave_data = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_BEHAVE_DATA)
326-
behave_tags = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_BEHAVE_TAGS)
327-
junit = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_JUNIT)
328-
verbose = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_VERBOSE)
338+
junit = None
339+
try:
340+
junit = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_JUNIT)
341+
except Exception:
342+
pass
343+
344+
verbose = None
345+
try:
346+
verbose = self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_VERBOSE)
347+
except Exception:
348+
pass
329349

330350
# configuration file for ansible
331-
if self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_EXEC_TYPE) == 'ansible':
332-
ansible_conf = self._working_dir_obj.exec_type_conf_path()
333-
else:
334-
ansible_conf = None
351+
ansible_conf = None
352+
try:
353+
if self._cli_conf_obj.get(CTFCliConfig.GLOBAL_SECTION_NAME, CTFCliConfig.CONFIG_EXEC_TYPE) == 'ansible':
354+
ansible_conf = self._working_dir_obj.exec_type_conf_path()
355+
except Exception:
356+
pass
335357

336358
command = [
337359
'behave'

0 commit comments

Comments
 (0)