Skip to content

Commit

Permalink
removed static check for py2 and only run tests for extensions that h…
Browse files Browse the repository at this point in the history
…ave been edited (#244)
  • Loading branch information
williexu authored Jul 20, 2018
1 parent fed9c09 commit 13599aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ install:
- pip install pylint==1.9.2 flake8 requests wheel==0.30.0 -q
jobs:
include:
- stage: precheck
env: PURPOSE='SourceStatic'
script: ./scripts/ci/test_static.sh
python: 2.7
- stage: precheck
env: PURPOSE='SourceStatic'
script: ./scripts/ci/test_static.sh
Expand All @@ -21,11 +17,11 @@ jobs:
python: 3.6
- stage: verify
env: PURPOSE='SourceTests'
script: travis_wait 40 ./scripts/ci/test_source.sh
script: ./scripts/ci/test_source.sh
python: 2.7
- stage: verify
env: PURPOSE='SourceTests'
script: travis_wait 40 ./scripts/ci/test_source.sh
script: ./scripts/ci/test_source.sh
python: 3.6
- stage: verify
env: PURPOSE='IndexRefDocVerify'
Expand Down
17 changes: 12 additions & 5 deletions scripts/ci/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@

for src_d in os.listdir(SRC_PATH):
src_d_full = os.path.join(SRC_PATH, src_d)
if os.path.isdir(src_d_full):
pkg_name = next((d for d in os.listdir(src_d_full) if d.startswith('azext_')), None)
# Find the package and check it has tests
if pkg_name and os.path.isdir(os.path.join(src_d_full, pkg_name, 'tests')):
ALL_TESTS.append((pkg_name, src_d_full))
if not os.path.isdir(src_d_full):
continue
pkg_name = next((d for d in os.listdir(src_d_full) if d.startswith('azext_')), None)

# If running in Travis CI, only run tests for edited extensions
commit_range = os.environ.get('TRAVIS_COMMIT_RANGE')
if commit_range and not check_output(['git', '--no-pager', 'diff', '--name-only', commit_range, '--', src_d_full]):
continue

# Find the package and check it has tests
if pkg_name and os.path.isdir(os.path.join(src_d_full, pkg_name, 'tests')):
ALL_TESTS.append((pkg_name, src_d_full))


class TestExtensionSourceMeta(type):
Expand Down

0 comments on commit 13599aa

Please sign in to comment.