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
6f16660c
Commit
6f16660c
authored
Nov 25, 2011
by
Meador Inge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12618: create unit tests for the py_compile module
parent
11e38131
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
Lib/test/test_py_compile.py
Lib/test/test_py_compile.py
+42
-0
No files found.
Lib/test/test_py_compile.py
0 → 100644
View file @
6f16660c
import
imp
import
os
import
py_compile
import
shutil
import
tempfile
import
unittest
from
test
import
support
,
script_helper
class
PyCompileTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
directory
=
tempfile
.
mkdtemp
()
self
.
source_path
=
os
.
path
.
join
(
self
.
directory
,
'_test.py'
)
self
.
pyc_path
=
self
.
source_path
+
'c'
self
.
cache_path
=
imp
.
cache_from_source
(
self
.
source_path
)
with
open
(
self
.
source_path
,
'w'
)
as
file
:
file
.
write
(
'x = 123
\
n
'
)
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
directory
)
def
test_absolute_path
(
self
):
py_compile
.
compile
(
self
.
source_path
,
self
.
pyc_path
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
pyc_path
))
self
.
assertFalse
(
os
.
path
.
exists
(
self
.
cache_path
))
def
test_cache_path
(
self
):
py_compile
.
compile
(
self
.
source_path
)
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
cache_path
))
def
test_relative_path
(
self
):
py_compile
.
compile
(
os
.
path
.
relpath
(
self
.
source_path
),
os
.
path
.
relpath
(
self
.
pyc_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
self
.
pyc_path
))
self
.
assertFalse
(
os
.
path
.
exists
(
self
.
cache_path
))
def
test_main
():
support
.
run_unittest
(
PyCompileTests
)
if
__name__
==
"__main__"
:
test_main
()
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