Skip to content

Commit

Permalink
test: use Travis CI to run tests on every pull request
Browse files Browse the repository at this point in the history
This is a second attempt at #1336 which got into a bad git-state...

Use flake8 to find Python syntax errors and undefined names.  There are Python 3 syntax errors and many undefined names which may raise NameError at runtime. This PR runs flake8 runs in two passes: The first looks at critical issues in stop-the-build mode and the second looks at style violations in everything-is-a-warning mode.

PR-URL: #1752
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
cclauss authored and rvagg committed Jun 20, 2019
1 parent 8b7fdd1 commit 051b6ed
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
24 changes: 24 additions & 0 deletions .travis.yml
@@ -0,0 +1,24 @@
dist: xenial
language: python
cache: pip
python:
- 2.7
- 3.7
matrix:
allow_failures:
- python: 3.7
install:
#- pip install -r requirements.txt
- pip install flake8 # pytest # add another testing frameworks later
before_script:
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- npm install
script:
- npm test
#- pytest --capture=sys # add other tests here
notifications:
on_success: change
on_failure: change # `always` will be the setting once code changes slow down
6 changes: 3 additions & 3 deletions gyp/pylib/gyp/MSVSVersion.py
Expand Up @@ -178,15 +178,15 @@ def _RegistryGetValueUsingWinReg(key, value):
"""
try:
# Python 2
from _winreg import OpenKey, QueryValueEx
from _winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx
except ImportError:
# Python 3
from winreg import OpenKey, QueryValueEx
from winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx

try:
root, subkey = key.split('\\', 1)
assert root == 'HKLM' # Only need HKLM for now.
with OpenKey(_winreg.HKEY_LOCAL_MACHINE, subkey) as hkey:
with OpenKey(HKEY_LOCAL_MACHINE, subkey) as hkey:
return QueryValueEx(hkey, value)[0]
except WindowsError:
return None
Expand Down
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/input.py
Expand Up @@ -1182,7 +1182,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key):
if variable_name in variables:
# If the variable is already set, don't set it.
continue
if the_dict_key is 'variables' and variable_name in the_dict:
if the_dict_key == 'variables' and variable_name in the_dict:
# If the variable is set without a % in the_dict, and the_dict is a
# variables dict (making |variables| a varaibles sub-dict of a
# variables dict), use the_dict's definition.
Expand Down
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/xcode_emulation.py
Expand Up @@ -844,7 +844,7 @@ def GetLdflags(self, configname, product_dir, gyp_to_build_path, arch=None):
if self._IsXCTest():
platform_root = self._XcodePlatformPath(configname)
if platform_root:
cflags.append('-F' + platform_root + '/Developer/Library/Frameworks/')
cflags.append('-F' + platform_root + '/Developer/Library/Frameworks/') # noqa TODO @cclauss

is_extension = self._IsIosAppExtension() or self._IsIosWatchKitExtension()
if sdk_root and is_extension:
Expand Down

0 comments on commit 051b6ed

Please sign in to comment.