Skip to content

Commit 3ab86b3

Browse files
committed
Reworking tests
1 parent 998f459 commit 3ab86b3

File tree

21 files changed

+213
-74
lines changed

21 files changed

+213
-74
lines changed

main_test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from pathlib import Path
2+
from nimporter.lib import *
3+
4+
root = Path('tests')
5+
6+
# for ext_path in find_extensions(root):
7+
# try:
8+
# ext = ExtLib(ext_path, root)
9+
# except Exception as e:
10+
# print(e)
11+
# continue
12+
13+
# print(ext)
14+
15+
import tests.data.ext_mod_basic.ext_mod_basic as ext_mod_basic
16+
17+
print('200 + 300 =', ext_mod_basic.add(200, 300))

nimporter/lib.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,17 +290,6 @@ def walk_folder(path):
290290
return digest.digest()
291291

292292

293-
294-
295-
296-
# TODO(pbz): Create an ExtLib using an ext mod single Nim file with right paths
297-
# TODO(pbz): Create an ExtLib using an ext mod single Nim file with right paths
298-
# TODO(pbz): Create an ExtLib using an ext mod single Nim file with right paths
299-
# TODO(pbz): Create an ExtLib using an ext mod single Nim file with right paths
300-
# TODO(pbz): Create an ExtLib using an ext mod single Nim file with right paths
301-
# TODO(pbz): Create an ExtLib using an ext mod single Nim file with right paths
302-
303-
304293
class ExtLib:
305294
"""
306295
All extensions are assumed to be libraries only. Modules are convert to

nimporter/nimporter.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -204,37 +204,6 @@ def nimport(
204204

205205
ic(module_path)
206206

207-
# if library:
208-
# dir_containing_lib_or_mod = module_path.parent.parent
209-
# else:
210-
# dir_containing_lib_or_mod = module_path.parent
211-
212-
# ic(dir_containing_lib_or_mod)
213-
214-
# ? Perhaps: if mod.is_absolute(): mod.relative_to(the_search_path)
215-
# compile_extensions_to_lib(
216-
# # * Had to prove the file existed using absolute paths. Now,
217-
# # * convert it back to a relative path to not have the MANIFEST
218-
# # * of the distribution contain the user's file system details.
219-
# # * In addition, library hashing won't work with absolute
220-
# # * paths.
221-
# dir_containing_lib_or_mod.relative_to(the_search_path)
222-
# )
223-
224-
# TODO(pbz): Caching isn't working with this
225-
226-
# TODO(pbz): MAKE FORMAL SCRIPT TO TEST THIS WITHOUT PYTEST HARNESS
227-
228-
# compile_extension_to_lib(
229-
# # * Had to prove the file existed using absolute paths. Now,
230-
# # * convert it back to a relative path to not have the MANIFEST
231-
# # * of the distribution contain the user's file system details.
232-
# # * In addition, library hashing won't work with absolute
233-
# # * paths.
234-
# # dir_containing_lib_or_mod.relative_to(the_search_path)
235-
# module_path
236-
# )
237-
238207
ext = ExtLib(module_path, Path())
239208
ic(ext)
240209

tests/data/ext_lib_in_deep_heirarchy/deep1/deep2/deep3/deep/deep.nim renamed to tests/data/deep1/deep2/deep3/deep/deep.nim

File renamed without changes.

tests/data/ext_lib_in_deep_heirarchy/deep1/deep2/deep3/deep/deep.nim.cfg renamed to tests/data/deep1/deep2/deep3/deep/deep.nim.cfg

File renamed without changes.

tests/data/ext_lib_in_deep_heirarchy/deep1/deep2/deep3/deep/deep.nimble renamed to tests/data/deep1/deep2/deep3/deep/deep.nimble

File renamed without changes.

tests/data/ext_lib_in_shallow_heirarchy/ext_lib_in_shallow_heirarchy.nim.cfg renamed to tests/data/pkg1/__init__.py

File renamed without changes.

tests/nexporting/extension_libraries/test_nexport_ext_libs.py renamed to tests/data/pkg1/pkg2/__init__.py

File renamed without changes.

tests/data/pkg1/pkg2/ext_mod_in_pkg.nim

Whitespace-only changes.

tests/data/py_module.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
def py_function():
3+
return 3.14

0 commit comments

Comments
 (0)