Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
6f2c0bc3
Commit
6f2c0bc3
authored
11 years ago
by
Christoph Groth
Browse files
Options
Downloads
Patches
Plain Diff
add test command to setup.py
parent
01b01376
No related branches found
Branches containing commit
Tags
v0.1.0
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+30
-4
30 additions, 4 deletions
setup.py
with
30 additions
and
4 deletions
setup.py
+
30
−
4
View file @
6f2c0bc3
...
...
@@ -23,9 +23,10 @@ import os
import
glob
import
subprocess
import
ConfigParser
from
distutils.core
import
setup
,
Command
from
distutils.extension
import
Extension
from
distutils.errors
import
DistutilsError
,
CCompilerError
from
distutils.core
import
setup
,
Extension
,
Command
from
distutils.util
import
get_platform
from
distutils.errors
import
DistutilsError
,
DistutilsModuleError
,
\
CCompilerError
from
distutils.command.build
import
build
as
distutils_build
from
distutils.command.sdist
import
sdist
as
distutils_sdist
import
numpy
...
...
@@ -101,6 +102,30 @@ class kwant_build(distutils_build):
sub_commands
=
[(
'
build_tut
'
,
None
)]
+
distutils_build
.
sub_commands
class
test
(
Command
):
description
=
"
build, then run the unit tests
"
user_options
=
[]
def
initialize_options
(
self
):
pass
def
finalize_options
(
self
):
pass
def
run
(
self
):
try
:
from
nose.core
import
run
except
ImportError
:
raise
DistutilsModuleError
(
'
nose <http://nose.readthedocs.org/>
'
'
is needed to run the tests
'
)
self
.
run_command
(
'
build
'
)
major
,
minor
=
sys
.
version_info
[:
2
]
lib_dir
=
"
build/lib.{0}-{1}.{2}
"
.
format
(
get_platform
(),
major
,
minor
)
print
'
**************** Tests ****************
'
if
not
run
(
argv
=
[
__file__
,
'
-v
'
,
lib_dir
]):
raise
DistutilsError
(
'
at least one of the tests failed
'
)
def
git_lsfiles
():
try
:
p
=
subprocess
.
Popen
([
'
git
'
,
'
ls-files
'
],
cwd
=
kwant_dir
,
...
...
@@ -410,7 +435,8 @@ def main():
cmdclass
=
{
'
build
'
:
kwant_build
,
'
sdist
'
:
kwant_sdist
,
'
build_ext
'
:
kwant_build_ext
,
'
build_tut
'
:
build_tut
},
'
build_tut
'
:
build_tut
,
'
test
'
:
test
},
ext_modules
=
ext_modules
(
extensions
()),
include_dirs
=
[
numpy
.
get_include
()])
...
...
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