Skip to content

Commit

Permalink
Fixes #495 test failing due to zlib not being compiled in some systems
Browse files Browse the repository at this point in the history
  • Loading branch information
lieryan committed Jul 21, 2022
1 parent 38bdaa4 commit ea40f51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions rope/contrib/autoimport/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def get_package_tuple(
if package_name.endswith(".so"):
package_name = package_name.split(".")[0]
package_type = PackageType.COMPILED
elif package_name.endswith(".pyd"):
package_name = package_name.split(".")[0]
package_type = PackageType.COMPILED
elif package_name.endswith(".py"):
package_name = package_path.stem
package_type = PackageType.SINGLE_FILE
Expand Down
6 changes: 3 additions & 3 deletions ropetest/contrib/autoimport/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def build_path():


@pytest.fixture
def zlib_path():
import zlib
def compiled_lib():
import _sqlite3

yield pathlib.Path(zlib.__file__)
yield "_sqlite3", pathlib.Path(_sqlite3.__file__)
8 changes: 4 additions & 4 deletions ropetest/contrib/autoimport/utilstest.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def test_get_package_tuple_typing(typing_path):
) == utils.get_package_tuple(typing_path)


@pytest.mark.skipif(platform == "win32", reason="Windows doesn't have compiled modules")
def test_get_package_tuple_compiled(zlib_path):
def test_get_package_tuple_compiled(compiled_lib):
lib_name, lib_path = compiled_lib
assert Package(
"zlib", Source.STANDARD, zlib_path, PackageType.COMPILED
) == utils.get_package_tuple(zlib_path)
lib_name, Source.STANDARD, lib_path, PackageType.COMPILED
) == utils.get_package_tuple(lib_path)

0 comments on commit ea40f51

Please sign in to comment.