Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
postpic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LabAstro
postpic
Commits
a25b8619
Commit
a25b8619
authored
Jul 20, 2015
by
Stephan Kuschel
Browse files
Options
Downloads
Patches
Plain Diff
add --autopep8 option to ./run-tests.py
parent
694ffeda
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
run-tests.py
+35
-1
35 additions, 1 deletion
run-tests.py
with
35 additions
and
1 deletion
run-tests.py
+
35
−
1
View file @
a25b8619
...
...
@@ -37,8 +37,22 @@ def exitonfailure(exitstatus, cmd=None):
print
(
cmd
)
exit
(
exitstatus
)
def
run_autopep8
(
args
):
import
autopep8
if
autopep8
.
__version__
<
'
1.2
'
:
print
(
'
upgrade to autopep8 >= 1.2 (installed: {:})
'
.
format
(
str
(
autopep8
.
__version__
)))
exit
(
1
)
autopep8mode
=
'
--in-place
'
if
args
.
autopep8
==
'
fix
'
else
'
--diff
'
cmd
=
'
autopep8 -r postpic --ignore-local-config
'
+
autopep8mode
+
'
'
\
'
--ignore=W391,E123,E226,E24 --max-line-length=99
'
print
(
'
===== running autopep8 =====
'
)
print
(
'
$
'
+
cmd
)
subprocess
.
call
(
cmd
,
shell
=
True
)
def
main
():
def
run_alltests
():
'''
runs all tests on postpic. This function has to exit without error on every commit!
'''
# make sure .pyx sources are up to date and compiled
subprocess
.
call
(
os
.
path
.
join
(
'
.
'
,
'
setup.py build_ext --inplace
'
),
shell
=
True
)
# run nose tests
...
...
@@ -56,6 +70,26 @@ def main():
print
(
'
$
'
+
cmd
)
exitonfailure
(
subprocess
.
call
(
cmd
,
shell
=
True
),
cmd
=
cmd
)
def
main
():
import
argparse
parser
=
argparse
.
ArgumentParser
(
description
=
'''
Without arguments this runs all tests
on the postpic codebase.
This script MUST EXIT WITHOUT ERROR on EVERY commit!
'''
)
parser
.
add_argument
(
'
--autopep8
'
,
default
=
''
,
nargs
=
'
?
'
,
metavar
=
'
fix
'
,
help
=
'''
run
"
autopep8
"
on the codebase.
Use
"
--autopep8
"
to preview changes. To apply them, use
"
--autopep8 fix
"
'''
)
args
=
parser
.
parse_args
()
if
args
.
autopep8
!=
''
:
run_autopep8
(
args
)
exit
()
run_alltests
()
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment