Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
de80ff4d
Commit
de80ff4d
authored
Aug 11, 2018
by
scoder
Committed by
GitHub
Aug 11, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2464 from gabrieldemarmiesse/enable_pep8_travis
Gradually enabling PEP8 checks on Travis ci.
parents
a8420f18
d68d0120
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
5 deletions
+47
-5
.travis.yml
.travis.yml
+11
-2
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+1
-1
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+1
-1
Demos/overflow_perf_run.py
Demos/overflow_perf_run.py
+1
-1
runtests.py
runtests.py
+26
-0
test-requirements.txt
test-requirements.txt
+1
-0
tox.ini
tox.ini
+6
-0
No files found.
.travis.yml
View file @
de80ff4d
...
...
@@ -44,6 +44,10 @@ env:
matrix
:
include
:
-
python
:
3.7
dist
:
xenial
# Required for Python 3.7
sudo
:
required
# travis-ci/travis-ci#9069
env
:
TEST_CODE_STYLE=1
-
python
:
3.7
dist
:
xenial
# Required for Python 3.7
sudo
:
required
# travis-ci/travis-ci#9069
...
...
@@ -144,9 +148,14 @@ install:
before_script
:
ccache -s ||
true
script
:
-
if [ "$TEST_CODE_STYLE" = "1" ]; then
STYLE_ARGS="--no-unit --no-doctest --no-file --no-pyregr --no-examples";
else
STYLE_ARGS=--no-code-style;
fi
-
PYTHON_DBG="python$( python -c 'import sys; print("%d.%d" % sys.version_info[:2])' )-dbg"
-
if $PYTHON_DBG -V >&2; then CFLAGS="-O0 -ggdb" $PYTHON_DBG runtests.py -vv Debugger --backends=$BACKEND; fi
-
if $PYTHON_DBG -V >&2; then CFLAGS="-O0 -ggdb" $PYTHON_DBG runtests.py -vv
$STYLE_ARGS
Debugger --backends=$BACKEND; fi
-
if [ "$BACKEND" = "cpp" -a -n "${TRAVIS_PYTHON_VERSION##2.6*}" ]; then pip install pythran; fi
-
if [ "$BACKEND" = "c" -a -n "${TRAVIS_PYTHON_VERSION##2*}" ]; then pip install mypy; fi
-
CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build_ext -i
-
CFLAGS="-O0 -ggdb -Wall -Wextra" python runtests.py -vv -x Debugger --backends=$BACKEND -j7
-
CFLAGS="-O0 -ggdb -Wall -Wextra" python runtests.py -vv
$STYLE_ARGS
-x Debugger --backends=$BACKEND -j7
Cython/Build/Dependencies.py
View file @
de80ff4d
...
...
@@ -230,7 +230,7 @@ class DistutilsInfo(object):
break
line
=
line
[
1
:].
lstrip
()
kind
=
next
((
k
for
k
in
(
"distutils:"
,
"cython:"
)
if
line
.
startswith
(
k
)),
None
)
if
not
kind
is
None
:
if
kind
is
not
None
:
key
,
_
,
value
=
[
s
.
strip
()
for
s
in
line
[
len
(
kind
):].
partition
(
'='
)]
type
=
distutils_settings
.
get
(
key
,
None
)
if
line
.
startswith
(
"cython:"
)
and
type
is
None
:
continue
...
...
Cython/Compiler/ModuleNode.py
View file @
de80ff4d
...
...
@@ -113,7 +113,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
env
.
doc
=
self
.
doc
=
None
elif
Options
.
embed_pos_in_docstring
:
env
.
doc
=
EncodedString
(
u'File: %s (starting at line %s)'
%
Nodes
.
relative_position
(
self
.
pos
))
if
not
self
.
doc
is
None
:
if
self
.
doc
is
not
None
:
env
.
doc
=
EncodedString
(
env
.
doc
+
u'
\
n
'
+
self
.
doc
)
env
.
doc
.
encoding
=
self
.
doc
.
encoding
else
:
...
...
Demos/overflow_perf_run.py
View file @
de80ff4d
...
...
@@ -16,7 +16,7 @@ def run_tests(N):
print
(
func
.
__name__
)
for
type
in
[
'int'
,
'unsigned int'
,
'long long'
,
'unsigned long long'
,
'object'
]:
if
func
==
most_orthogonal
:
if
type
==
'object'
or
np
==
None
:
if
type
==
'object'
or
np
is
None
:
continue
type_map
=
{
'int'
:
'int32'
,
'unsigned int'
:
'uint32'
,
'long long'
:
'int64'
,
'unsigned long long'
:
'uint64'
}
shape
=
N
,
3
...
...
runtests.py
View file @
de80ff4d
...
...
@@ -1446,6 +1446,22 @@ class CythonPyregrTestCase(CythonRunTestCase):
run_forked_test(result, run_test, self.shortDescription(), self.fork)
class TestCodeFormat(unittest.TestCase):
def __init__(self, cython_dir):
self.cython_dir = cython_dir
unittest.TestCase.__init__(self)
def runTest(self):
import pycodestyle
config_file = os.path.join(self.cython_dir, "tox.ini")
paths = glob.glob(os.path.join(self.cython_dir, "**/*.py"), recursive=True)
style = pycodestyle.StyleGuide(config_file=config_file)
print("") # Fix the first line of the report.
result = style.check_files(paths)
self.assertEqual(result.total_errors, 0, "Found code style errors.")
include_debugger = IS_CPYTHON
...
...
@@ -1868,6 +1884,9 @@ def main():
parser.add_option("--no-examples", dest="examples",
action="store_false", default=True,
help="Do not run the documentation tests in the examples directory.")
parser.add_option("--no-code-style", dest="code_style",
action="store_false", default=True,
help="Do not run the code style (PEP8) checks.")
parser.add_option("--cython-only", dest="cython_only",
action="store_true", default=False,
help="only compile pyx to c, do not run C compiler or run the tests")
...
...
@@ -1949,6 +1968,10 @@ def main():
if options.with_cython and sys.version_info[0] >= 3:
sys.path.insert(0, options.cython_dir)
# requires glob with the wildcard.
if sys.version_info < (3, 5) or cmd_args:
options.code_style = False
WITH_CYTHON = options.with_cython
coverage = None
...
...
@@ -2214,6 +2237,9 @@ def runtests(options, cmd_args, coverage=None):
sys.stderr.write("Including CPython regression tests in %s
\
n
" % sys_pyregr_dir)
test_suite.addTest(filetests.handle_directory(sys_pyregr_dir, 'pyregr'))
if options.code_style and options.shard_num <= 0:
test_suite.addTest(TestCodeFormat(options.cython_dir))
if xml_output_dir:
from Cython.Tests.xmlrunner import XMLTestRunner
if not os.path.exists(xml_output_dir):
...
...
test-requirements.txt
View file @
de80ff4d
numpy
jupyter
coverage
pycodestyle
tox.ini
View file @
de80ff4d
...
...
@@ -10,3 +10,9 @@ envlist = py26, py27, py32, py33, py34, pypy
setenv
=
CFLAGS=-O0 -ggdb
commands
=
{envpython}
runtests.py
-vv
[pycodestyle]
ignore
=
W, E
select
=
E711, E714
max-line-length
=
300
format
=
pylint
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment