Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kevin Lyda
chkcrontab
Commits
f836ce78
Commit
f836ce78
authored
Jan 02, 2017
by
Kevin Lyda
💬
Committed by
GitHub
Jan 02, 2017
Browse files
Merge pull request #8 from pmclanahan/fix-install-python-26
Fix #6: Only import unittest during test run.
parents
efc7c3bd
1a036be6
Pipeline
#1040
passed with stage
in 3 minutes and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
setup.py
View file @
f836ce78
...
...
@@ -25,10 +25,7 @@ from distutils import log
from
distutils.command.install
import
install
from
distutils.core
import
setup
from
distutils.core
import
Command
if
sys
.
version_info
<
(
2
,
7
):
import
unittest2
as
unittest
else
:
import
unittest
BASE_DIR
=
os
.
path
.
dirname
(
globals
().
get
(
'__file__'
,
os
.
getcwd
()))
...
...
@@ -44,6 +41,14 @@ class TestCmd(Command):
pass
def
run
(
self
):
if
sys
.
version_info
<
(
2
,
7
):
try
:
import
unittest2
as
unittest
except
ImportError
:
raise
RuntimeError
(
'unittest2 required for running tests under Python < 2.7.'
)
else
:
import
unittest
test_dir
=
os
.
path
.
join
(
BASE_DIR
,
'tests'
)
tests
=
unittest
.
TestLoader
().
discover
(
test_dir
)
...
...
@@ -52,6 +57,7 @@ class TestCmd(Command):
if
not
result
.
wasSuccessful
():
sys
.
exit
(
1
)
class
CleanCmd
(
Command
):
description
=
'Remove all generated files.'
user_options
=
[]
...
...
@@ -153,6 +159,7 @@ class InstallCmd(install):
os
.
path
.
join
(
manpage_dir
,
manpage_file
),
dry_run
=
self
.
dry_run
)
# Only override install if not being run by setuptools.
cmdclass
=
{
'test'
:
TestCmd
,
'dist_clean'
:
CleanCmd
,
...
...
@@ -160,6 +167,7 @@ cmdclass = {'test': TestCmd,
if
'setuptools'
not
in
dir
():
cmdclass
[
'install'
]
=
InstallCmd
setup
(
cmdclass
=
cmdclass
,
name
=
'chkcrontab'
,
...
...
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