Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
f61e759d
Commit
f61e759d
authored
Feb 16, 2022
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix depfile tests on Windows.
parent
5ba24b45
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
19 deletions
+25
-19
tests/build/depfile.srctree
tests/build/depfile.srctree
+3
-3
tests/build/depfile_numpy.srctree
tests/build/depfile_numpy.srctree
+16
-9
tests/build/depfile_package.srctree
tests/build/depfile_package.srctree
+6
-7
No files found.
tests/build/depfile.srctree
View file @
f61e759d
"""
PYTHON -m Cython.Build.Cythonize -M foo.pyx
PYTHON -m Cython.Build.Cythonize -M foo.pyx
PYTHON check.py
PYTHON check.py
"""
######## foo.pyx ########
######## foo.pyx ########
...
@@ -25,9 +27,7 @@ cdef inline void empty():
...
@@ -25,9 +27,7 @@ cdef inline void empty():
######## check.py ########
######## check.py ########
import os
with open("foo.c.dep", "r") as f:
with open("foo.c.dep", "r") as f:
contents = f.read().replace("\
n", " ").replace("\\", "
")
contents = f.read().replace("\
\\n", " ").replace("\n", "
")
assert sorted(contents.split()) == ['bar.pxd', 'baz.pxi', 'foo.c:', 'foo.pyx'], contents
assert sorted(contents.split()) == ['bar.pxd', 'baz.pxi', 'foo.c:', 'foo.pyx'], contents
tests/build/depfile_numpy.srctree
View file @
f61e759d
# tag: numpy
# tag: numpy
"""
PYTHON -m Cython.Build.Cythonize -M dep_np.pyx
PYTHON -m Cython.Build.Cythonize -M dep_np.pyx
PYTHON check_np.py
PYTHON check_np.py
"""
######## dep_np.pyx ########
######## dep_np.pyx ########
...
@@ -12,14 +14,13 @@ np.import_array()
...
@@ -12,14 +14,13 @@ np.import_array()
######## check_np.py ########
######## check_np.py ########
import os
import os.path
import re
import numpy as np
import numpy as np
import Cython
import Cython
with open("dep_np.c.dep", "r") as f:
with open("dep_np.c.dep", "r") as f:
contents = f.read().replace(
"\n", " ").replace("\\", ""
)
contents = f.read().replace(
'\\\n', ' ').replace('\n', ' '
)
contents = contents.split()
contents = contents.split()
...
@@ -29,7 +30,11 @@ contents = [fname.replace(cy_prefix, "cy_prefix") for fname in contents]
...
@@ -29,7 +30,11 @@ contents = [fname.replace(cy_prefix, "cy_prefix") for fname in contents]
np_prefix, _ = os.path.split(np.__file__)
np_prefix, _ = os.path.split(np.__file__)
contents = [fname.replace(np_prefix, "np_prefix") for fname in contents]
contents = [fname.replace(np_prefix, "np_prefix") for fname in contents]
expected = ['cy_prefix/Includes/cpython/buffer.pxd',
contents = [path.split(os.sep) for path in contents]
contents.sort()
expected = [path.split('/') for path in [
'cy_prefix/Includes/cpython/buffer.pxd',
'cy_prefix/Includes/cpython/mem.pxd',
'cy_prefix/Includes/cpython/mem.pxd',
'cy_prefix/Includes/cpython/object.pxd',
'cy_prefix/Includes/cpython/object.pxd',
'cy_prefix/Includes/cpython/ref.pxd',
'cy_prefix/Includes/cpython/ref.pxd',
...
@@ -37,13 +42,15 @@ expected = ['cy_prefix/Includes/cpython/buffer.pxd',
...
@@ -37,13 +42,15 @@ expected = ['cy_prefix/Includes/cpython/buffer.pxd',
'cy_prefix/Includes/libc/stdio.pxd',
'cy_prefix/Includes/libc/stdio.pxd',
'cy_prefix/Includes/libc/string.pxd',
'cy_prefix/Includes/libc/string.pxd',
'dep_np.c:',
'dep_np.c:',
'dep_np.pyx',]
'dep_np.pyx',
]]
# Also account for legacy numpy versions, which do not ship
# Also account for legacy numpy versions, which do not ship
# `__init__.pxd` hence the fallback is used:
# `__init__.pxd` hence the fallback is used:
if
'cy_prefix/Includes/numpy/__init__.pxd'
in contents:
if
['cy_prefix', 'Includes', 'numpy', '__init__.pxd']
in contents:
expected.append(
'cy_prefix/Includes/numpy/__init__.pxd'
)
expected.append(
['cy_prefix', 'Includes', 'numpy', '__init__.pxd']
)
else:
else:
expected.append(
'np_prefix/__init__.pxd'
)
expected.append(
['np_prefix', '__init__.pxd']
)
assert sorted(contents) == sorted(expected), sorted(contents)
expected.sort()
assert contents == expected, contents
tests/build/depfile_package.srctree
View file @
f61e759d
'''
"""
PYTHON -m Cython.Build.Cythonize -i pkg --depfile
PYTHON -m Cython.Build.Cythonize -i pkg --depfile
PYTHON package_test.py
PYTHON package_test.py
'''
"""
######## package_test.py ########
######## package_test.py ########
import os
import os
.path
with open("pkg/test.c.dep", "r") as f:
with open("pkg/test.c.dep", "r") as f:
contents = f.read().replace("\
n", " ").replace("\\", "
")
contents = f.read().replace("\
\\n", " ").replace("\\\n", "
")
assert sorted(contents.split()) == sorted(['test.c:',
'sub/incl.pxi'
, 'test.pxd', 'test.pyx']), contents
assert sorted(contents.split()) == sorted(['test.c:',
os.path.join('sub', 'incl.pxi')
, 'test.pxd', 'test.pyx']), contents
with open("pkg/sub/test.c.dep", "r") as f:
with open("pkg/sub/test.c.dep", "r") as f:
...
@@ -18,7 +18,7 @@ with open("pkg/sub/test.c.dep", "r") as f:
...
@@ -18,7 +18,7 @@ with open("pkg/sub/test.c.dep", "r") as f:
contents = [os.path.relpath(entry, '.')
contents = [os.path.relpath(entry, '.')
if os.path.isabs(entry) else entry for entry in contents.split()]
if os.path.isabs(entry) else entry for entry in contents.split()]
assert sorted(contents) == sorted(['test.c:', 'incl.pxi', 'test.pyx',
'../test.pxd'
]), contents
assert sorted(contents) == sorted(['test.c:', 'incl.pxi', 'test.pyx',
os.path.join('..', 'test.pxd')
]), contents
######## pkg/__init__.py ########
######## pkg/__init__.py ########
...
@@ -55,4 +55,3 @@ TEST = 'pkg.sub.test'
...
@@ -55,4 +55,3 @@ TEST = 'pkg.sub.test'
######## pkg/sub/incl.pxi ########
######## pkg/sub/incl.pxi ########
pass
pass
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