Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b3b49cd1
Commit
b3b49cd1
authored
May 27, 2012
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refined venv tests.
parent
36432ea7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
9 deletions
+26
-9
Lib/test/test_venv.py
Lib/test/test_venv.py
+26
-9
No files found.
Lib/test/test_venv.py
View file @
b3b49cd1
...
@@ -52,19 +52,19 @@ class BaseTest(unittest.TestCase):
...
@@ -52,19 +52,19 @@ class BaseTest(unittest.TestCase):
class
BasicTest
(
BaseTest
):
class
BasicTest
(
BaseTest
):
"""Test venv module functionality."""
"""Test venv module functionality."""
def
isdir
(
self
,
*
args
):
fn
=
self
.
get_env_file
(
*
args
)
self
.
assertTrue
(
os
.
path
.
isdir
(
fn
))
def
test_defaults
(
self
):
def
test_defaults
(
self
):
"""
"""
Test the create function with default arguments.
Test the create function with default arguments.
"""
"""
def
isdir
(
*
args
):
fn
=
self
.
get_env_file
(
*
args
)
self
.
assertTrue
(
os
.
path
.
isdir
(
fn
))
shutil
.
rmtree
(
self
.
env_dir
)
shutil
.
rmtree
(
self
.
env_dir
)
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
)
self
.
run_with_capture
(
venv
.
create
,
self
.
env_dir
)
isdir
(
self
.
bindir
)
self
.
isdir
(
self
.
bindir
)
isdir
(
self
.
include
)
self
.
isdir
(
self
.
include
)
isdir
(
*
self
.
lib
)
self
.
isdir
(
*
self
.
lib
)
data
=
self
.
get_text_file_contents
(
'pyvenv.cfg'
)
data
=
self
.
get_text_file_contents
(
'pyvenv.cfg'
)
if
sys
.
platform
==
'darwin'
and
(
'__PYTHONV_LAUNCHER__'
if
sys
.
platform
==
'darwin'
and
(
'__PYTHONV_LAUNCHER__'
in
os
.
environ
):
in
os
.
environ
):
...
@@ -77,8 +77,9 @@ class BasicTest(BaseTest):
...
@@ -77,8 +77,9 @@ class BasicTest(BaseTest):
self
.
assertTrue
(
data
.
startswith
(
'#!%s%s'
%
(
self
.
env_dir
,
os
.
sep
)))
self
.
assertTrue
(
data
.
startswith
(
'#!%s%s'
%
(
self
.
env_dir
,
os
.
sep
)))
fn
=
self
.
get_env_file
(
self
.
bindir
,
self
.
exe
)
fn
=
self
.
get_env_file
(
self
.
bindir
,
self
.
exe
)
if
not
os
.
path
.
exists
(
fn
):
# diagnostics for Windows buildbot failures
if
not
os
.
path
.
exists
(
fn
):
# diagnostics for Windows buildbot failures
print
(
'Contents of %r:'
%
self
.
bindir
)
bd
=
self
.
get_env_file
(
self
.
bindir
)
print
(
' %r'
%
os
.
listdir
(
self
.
bindir
))
print
(
'Contents of %r:'
%
bd
)
print
(
' %r'
%
os
.
listdir
(
bd
))
self
.
assertTrue
(
os
.
path
.
exists
(
fn
),
'File %r should exist.'
%
fn
)
self
.
assertTrue
(
os
.
path
.
exists
(
fn
),
'File %r should exist.'
%
fn
)
def
test_overwrite_existing
(
self
):
def
test_overwrite_existing
(
self
):
...
@@ -89,6 +90,22 @@ class BasicTest(BaseTest):
...
@@ -89,6 +90,22 @@ class BasicTest(BaseTest):
builder
=
venv
.
EnvBuilder
(
clear
=
True
)
builder
=
venv
.
EnvBuilder
(
clear
=
True
)
builder
.
create
(
self
.
env_dir
)
builder
.
create
(
self
.
env_dir
)
def
test_upgrade
(
self
):
"""
Test upgrading an existing environment directory.
"""
builder
=
venv
.
EnvBuilder
(
upgrade
=
True
)
self
.
run_with_capture
(
builder
.
create
,
self
.
env_dir
)
self
.
isdir
(
self
.
bindir
)
self
.
isdir
(
self
.
include
)
self
.
isdir
(
*
self
.
lib
)
fn
=
self
.
get_env_file
(
self
.
bindir
,
self
.
exe
)
if
not
os
.
path
.
exists
(
fn
):
# diagnostics for Windows buildbot failures
bd
=
self
.
get_env_file
(
self
.
bindir
)
print
(
'Contents of %r:'
%
bd
)
print
(
' %r'
%
os
.
listdir
(
bd
))
self
.
assertTrue
(
os
.
path
.
exists
(
fn
),
'File %r should exist.'
%
fn
)
def
test_isolation
(
self
):
def
test_isolation
(
self
):
"""
"""
Test isolation from system site-packages
Test isolation from system site-packages
...
...
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