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
48377769
Commit
48377769
authored
Jan 02, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use importorskip to detect/load win32com
parent
c3e74e46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
28 deletions
+17
-28
setuptools/tests/test_sandbox.py
setuptools/tests/test_sandbox.py
+17
-28
No files found.
setuptools/tests/test_sandbox.py
View file @
48377769
...
...
@@ -6,22 +6,12 @@ import shutil
import
tempfile
import
types
import
pytest
import
pkg_resources
import
setuptools.sandbox
from
setuptools.sandbox
import
DirectorySandbox
,
SandboxViolation
def
has_win32com
():
"""
Run this to determine if the local machine has win32com, and if it
does, include additional tests.
"""
if
not
sys
.
platform
.
startswith
(
'win32'
):
return
False
try
:
__import__
(
'win32com'
)
except
ImportError
:
return
False
return
True
class
TestSandbox
:
...
...
@@ -44,23 +34,22 @@ class TestSandbox:
_file_writer
=
staticmethod
(
_file_writer
)
if
has_win32com
(
):
def
test_win32com
(
self
):
"""
win32com should not be prevented from caching COM interfaces
in gen_py.
"""
import
win32com
gen_py
=
win32com
.
__gen_path__
target
=
os
.
path
.
join
(
gen_py
,
'test_write'
)
sandbox
=
DirectorySandbox
(
self
.
dir
)
def
test_win32com
(
self
):
"""
win32com should not be prevented from caching COM interfaces
in gen_py.
"""
win32com
=
pytest
.
importorskip
(
'win32com'
)
gen_py
=
win32com
.
__gen_path__
target
=
os
.
path
.
join
(
gen_py
,
'test_write'
)
sandbox
=
DirectorySandbox
(
self
.
dir
)
try
:
try
:
try
:
sandbox
.
run
(
self
.
_file_writer
(
target
))
except
SandboxViolation
:
self
.
fail
(
"Could not create gen_py file due to SandboxViolation"
)
finally
:
if
os
.
path
.
exists
(
target
):
os
.
remove
(
target
)
sandbox
.
run
(
self
.
_file_writer
(
target
))
except
SandboxViolation
:
self
.
fail
(
"Could not create gen_py file due to SandboxViolation"
)
finally
:
if
os
.
path
.
exists
(
target
):
os
.
remove
(
target
)
def
test_setup_py_with_BOM
(
self
):
"""
...
...
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