Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
05b7bce8
Commit
05b7bce8
authored
Jun 15, 2004
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test that actually installs some scripts
parent
c32a93c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
tests/test_install_scripts.py
tests/test_install_scripts.py
+56
-0
No files found.
tests/test_install_scripts.py
View file @
05b7bce8
"""Tests for distutils.command.install_scripts."""
import
os
import
shutil
import
tempfile
import
unittest
from
distutils.command.install_scripts
import
install_scripts
...
...
@@ -9,6 +11,23 @@ from distutils.core import Distribution
class
InstallScriptsTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
tempdirs
=
[]
def
tearDown
(
self
):
while
self
.
tempdirs
:
d
=
self
.
tempdirs
.
pop
()
shutil
.
rmtree
(
d
)
def
mkdtemp
(
self
):
"""Create a temporary directory that will be cleaned up.
Returns the path of the directory.
"""
d
=
tempfile
.
mkdtemp
()
self
.
tempdirs
.
append
(
d
)
return
d
def
test_default_settings
(
self
):
dist
=
Distribution
()
dist
.
command_obj
[
"build"
]
=
DummyCommand
(
build_scripts
=
"/foo/bar"
)
...
...
@@ -30,8 +49,45 @@ class InstallScriptsTestCase(unittest.TestCase):
self
.
assertEqual
(
cmd
.
build_dir
,
"/foo/bar"
)
self
.
assertEqual
(
cmd
.
install_dir
,
"/splat/funk"
)
def
test_installation
(
self
):
source
=
self
.
mkdtemp
()
expected
=
[]
def
write_script
(
name
,
text
):
expected
.
append
(
name
)
f
=
open
(
os
.
path
.
join
(
source
,
name
),
"w"
)
f
.
write
(
text
)
f
.
close
()
write_script
(
"script1.py"
,
(
"#! /usr/bin/env python2.3
\
n
"
"# bogus script w/ Python sh-bang
\
n
"
"pass
\
n
"
))
write_script
(
"script2.py"
,
(
"#!/usr/bin/python
\
n
"
"# bogus script w/ Python sh-bang
\
n
"
"pass
\
n
"
))
write_script
(
"shell.sh"
,
(
"#!/bin/sh
\
n
"
"# bogus shell script w/ sh-bang
\
n
"
"exit 0
\
n
"
))
target
=
self
.
mkdtemp
()
dist
=
Distribution
()
dist
.
command_obj
[
"build"
]
=
DummyCommand
(
build_scripts
=
source
)
dist
.
command_obj
[
"install"
]
=
DummyCommand
(
install_scripts
=
target
,
force
=
1
,
skip_build
=
1
,
)
cmd
=
install_scripts
(
dist
)
cmd
.
finalize_options
()
cmd
.
run
()
installed
=
os
.
listdir
(
target
)
for
name
in
expected
:
self
.
assert_
(
name
in
installed
)
class
DummyCommand
:
"""Class to store options for retrieval via set_undefined_options()."""
def
__init__
(
self
,
**
kwargs
):
for
kw
,
val
in
kwargs
.
items
():
...
...
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