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
a440b1ce
Commit
a440b1ce
authored
May 10, 2009
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored test_sysconfig so it uses test.test_support.EnvironmentVarGuard
parent
a7de6ba0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
19 deletions
+19
-19
tests/support.py
tests/support.py
+11
-0
tests/test_sysconfig.py
tests/test_sysconfig.py
+8
-19
No files found.
tests/support.py
View file @
a440b1ce
...
...
@@ -5,6 +5,7 @@ import tempfile
from
distutils
import
log
from
distutils.core
import
Distribution
from
test.test_support
import
EnvironmentVarGuard
class
LoggingSilencer
(
object
):
...
...
@@ -82,3 +83,13 @@ class DummyCommand:
def
ensure_finalized
(
self
):
pass
class
EnvironGuard
(
object
):
def
setUp
(
self
):
super
(
EnvironGuard
,
self
).
setUp
()
self
.
environ
=
EnvironmentVarGuard
()
def
tearDown
(
self
):
self
.
environ
.
__exit__
()
super
(
EnvironGuard
,
self
).
tearDown
()
tests/test_sysconfig.py
View file @
a440b1ce
"""Tests for distutils.dist."""
from
distutils
import
sysconfig
from
distutils.ccompiler
import
get_default_compiler
"""Tests for distutils.sysconfig."""
import
os
import
unittest
from
distutils
import
sysconfig
from
distutils.ccompiler
import
get_default_compiler
from
distutils.tests
import
support
from
test.test_support
import
TESTFN
class
SysconfigTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
old_flags
=
[(
'AR'
,
os
.
environ
.
get
(
'AR'
)),
(
'ARFLAGS'
,
os
.
environ
.
get
(
'ARFLAGS'
))]
def
tearDown
(
self
):
for
name
,
value
in
self
.
old_flags
:
if
value
is
not
None
:
os
.
environ
[
name
]
=
value
elif
name
in
os
.
environ
:
del
os
.
environ
[
name
]
class
SysconfigTestCase
(
support
.
EnvironGuard
,
unittest
.
TestCase
):
def
test_get_config_h_filename
(
self
):
config_h
=
sysconfig
.
get_config_h_filename
()
...
...
@@ -53,8 +42,8 @@ class SysconfigTestCase(unittest.TestCase):
if
get_default_compiler
()
!=
'unix'
:
return
os
.
environ
[
'AR'
]
=
'my_ar'
os
.
environ
[
'ARFLAGS'
]
=
'-arflags'
self
.
environ
[
'AR'
]
=
'my_ar'
self
.
environ
[
'ARFLAGS'
]
=
'-arflags'
# make sure AR gets caught
class
compiler
:
...
...
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