Skip to content

Commit c3767e5

Browse files
fix running samples script (Azure#17318)
* disable timed samples for python 2.7 (for now) * skip form tests to run pipeline faster * oops * revert skipping tests * only install checkpointstoreblob-aio if not py27
1 parent e81ac03 commit c3767e5

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

scripts/devops_tasks/test_run_samples.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
import os
1212
import logging
1313
from fnmatch import fnmatch
14-
from subprocess import check_call, CalledProcessError, TimeoutExpired
14+
from subprocess import check_call, CalledProcessError
15+
try:
16+
from subprocess import TimeoutExpired
17+
except ImportError:
18+
pass
1519
from common_tasks import (
1620
run_check_call,
1721
process_glob_string,
@@ -157,7 +161,7 @@ def execute_sample(sample, samples_errors, timed):
157161
command_array = [sys.executable, sample]
158162

159163
if not timed:
160-
errors = run_check_call(command_array, root_dir)
164+
errors = run_check_call(command_array, root_dir, always_exit=False)
161165
else:
162166
errors = run_check_call_with_timeout(
163167
command_array, root_dir, timeout, pass_if_timeout
@@ -191,7 +195,7 @@ def run_samples(targeted_package):
191195
with open(samples_dir_path + "/sample_dev_requirements.txt") as sample_dev_reqs:
192196
for dep in sample_dev_reqs.readlines():
193197
check_call([sys.executable, '-m', 'pip', 'install', dep])
194-
except FileNotFoundError:
198+
except IOError:
195199
pass
196200

197201
for path, subdirs, files in os.walk(samples_dir_path):
@@ -217,6 +221,11 @@ def run_samples(targeted_package):
217221
execute_sample(sample, samples_errors, timed=False)
218222

219223
for sample in timed_sample_paths:
224+
if sys.version_info < (3, 5): # currently don't have a solution to run python 2.7 timed samples
225+
logging.info(
226+
"Unable to run timed sample: {} with python 2.7".format(sample[0])
227+
)
228+
continue
220229
execute_sample(sample, samples_errors, timed=True)
221230

222231
if samples_errors:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
azure-eventhub-checkpointstoreblob
2-
azure-eventhub-checkpointstoreblob-aio
2+
azure-eventhub-checkpointstoreblob-aio; python_version >= '3.5'

0 commit comments

Comments
 (0)