Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Kirill Smelkov
gevent
Commits
e8994144
Commit
e8994144
authored
Sep 15, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greentest: add xtest_pep8.py
parent
b059f651
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
greentest/xtest_pep8.py
greentest/xtest_pep8.py
+71
-0
No files found.
greentest/xtest_pep8.py
0 → 100644
View file @
e8994144
import
sys
import
os
import
unittest
import
glob
import
re
from
os.path
import
abspath
,
dirname
,
join
,
basename
# this regex matches filenames of the standard tests (with one underscore)
stdtest_re
=
re
.
compile
(
'^(test_[^_].+|lock_tests)
\
.py$
'
)
script = '
pep8
'
try:
index = sys.argv.index('
--
script
')
except ValueError:
pass
else:
script = sys.argv[index + 1]
del sys.argv[index:index + 2]
# E501 line too long (80 character limit that we don'
t
follow
)
command
=
script
+
' --repeat --statistics --ignore E501 %s | grep -v E501'
if
os
.
system
(
'pep8 --version'
):
sys
.
stderr
.
write
(
'Please install pep8 script
\
n
'
)
sys
.
exit
(
0
)
def
system
(
*
args
):
command
=
' '
.
join
(
args
)
popen_result
=
os
.
popen
(
command
)
result
=
popen_result
.
read
()
if
result
:
sys
.
stderr
.
write
(
result
)
raise
AssertionError
(
'pep8 failed'
)
class
Test
(
unittest
.
TestCase
):
def
test_gevent
(
self
):
import
gevent
# E221 multiple spaces before operator
system
(
command
%
join
(
abspath
(
dirname
(
gevent
.
__file__
)),
'*.py'
),
'| grep -v E221'
)
def
test_tests
(
self
):
# E702 multiple statements on one line (from gevent import monkey; monkey.patch_all())
files
=
glob
.
glob
(
join
(
abspath
(
dirname
(
__file__
)),
'*.py'
))
# filter out standard tests of form test_xxx.py (one underscore)
files
=
[
filename
for
filename
in
files
if
stdtest_re
.
match
(
basename
(
filename
))
is
None
]
system
(
command
%
(
' '
.
join
(
files
)),
'| grep -v E702'
)
# we keep the standard tests as close to the originals as possible, so don't test them
def
X_test_std_tests
(
self
):
# E702 multiple statements on one line (from gevent import monkey; monkey.patch_all())
files
=
glob
.
glob
(
join
(
abspath
(
dirname
(
__file__
)),
'*.py'
))
# only count standard tests of form test_xxx.py (one underscore)
files
=
[
filename
for
filename
in
files
if
stdtest_re
.
match
(
basename
(
filename
))
is
not
None
]
system
(
command
%
(
' '
.
join
(
files
)),
'| grep -v E702'
)
def
test_examples
(
self
):
# E702 multiple statements on one line (from gevent import monkey; monkey.patch_all())
system
(
command
%
join
(
dirname
(
abspath
(
dirname
(
__file__
))),
'examples'
,
'*.py'
),
'| grep -v E702'
)
def
test_setup
(
self
):
system
(
command
%
join
(
dirname
(
abspath
(
dirname
(
__file__
))),
'setup.py'
))
if
__name__
==
'__main__'
:
unittest
.
main
()
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