Skip to content

Commit

Permalink
Some renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
lieryan committed Feb 6, 2024
1 parent a7460c4 commit 4deab03
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include README.rst COPYING setup.py MANIFEST.in CHANGELOG.md ropetest-package-fixtures/example-external-package/dist/example_external_package-1.0.0.tar.gz ropetest-package-fixtures/example-external-package/dist/example_external_package-1.0.0-py3-none-any.whl
include README.rst COPYING setup.py MANIFEST.in CHANGELOG.md ropetest-package-fixtures/external_fixturepkg/dist/external_fixturepkg-1.0.0-py3-none-any.whl ropetest-package-fixtures/external_fixturepkg/dist/external_fixturepkg-1.0.0.tar.gz
recursive-include rope *.py
recursive-include docs *.rst
recursive-include ropetest *.py
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["flit-core >= 3.8"]
build-backend = "flit_core.buildapi"

[project]
name = "example_external_package"
name = "external_fixturepkg"
version = "1.0.0"
description = "Just an example project built with build/flit for testing purpose"
readme = "README.md"
Expand Down
13 changes: 10 additions & 3 deletions ropetest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ def mod2(project, pkg1) -> resources.Folder:


@pytest.fixture(scope="session")
def example_external_package():
check_call([sys.executable, "-m", "pip", "install", "--force-reinstall", "ropetest-package-fixtures/example-external-package/dist/example_external_package-1.0.0-py3-none-any.whl"])
def external_fixturepkg():
check_call([
sys.executable,
"-m",
"pip",
"install",
"--force-reinstall",
"ropetest-package-fixtures/external_fixturepkg/dist/external_fixturepkg-1.0.0-py3-none-any.whl",
])
yield
check_call([sys.executable, "-m", "pip", "uninstall", "--yes", "example-external-package"])
check_call([sys.executable, "-m", "pip", "uninstall", "--yes", "external-fixturepkg"])
12 changes: 6 additions & 6 deletions ropetest/contrib/autoimport/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ def typing_path():


@pytest.fixture
def example_external_package_module_path(example_external_package):
from example_external_package import example_module
yield pathlib.Path(example_module.__file__)
def example_external_package_module_path(external_fixturepkg):
from external_fixturepkg import mod1
yield pathlib.Path(mod1.__file__)


@pytest.fixture
def example_external_package_path(example_external_package):
import example_external_package
def example_external_package_path(external_fixturepkg):
import external_fixturepkg

# Uses __init__.py so we need the parent

yield pathlib.Path(example_external_package.__file__).parent
yield pathlib.Path(external_fixturepkg.__file__).parent


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions ropetest/contrib/autoimport/utilstest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_get_package_source_pytest(example_external_package_path):
# pytest is not installed as part of the standard library
# but should be installed into site_packages,
# so it should return Source.SITE_PACKAGE
source = utils.get_package_source(example_external_package_path, None, "example_module")
source = utils.get_package_source(example_external_package_path, None, "mod1")
assert source == Source.SITE_PACKAGE


Expand All @@ -42,7 +42,7 @@ def test_get_modname_folder(
example_external_package_module_path,
example_external_package_path,
)
assert modname == "example_external_package.example_module"
assert modname == "external_fixturepkg.mod1"


def test_get_package_tuple_sample(project_path):
Expand Down
12 changes: 6 additions & 6 deletions ropetest/contrib/autoimporttest.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ def test_skipping_directories_not_accessible_because_of_permission_error(self):
self.assertGreater(len(self.importer._dump_all()), 0)


def test_search_submodule(example_external_package):
def test_search_submodule(external_fixturepkg):
project = testutils.sample_project(extension_modules=["sys"])
importer = autoimport.AutoImport(project, observe=False)
importer.update_module("example_external_package")
import_statement = ("from example_external_package import example_module", "example_module")
assert import_statement in importer.search("example_module", exact_match=True)
assert import_statement in importer.search("exam")
assert import_statement in importer.search("example_module")
importer.update_module("external_fixturepkg")
import_statement = ("from external_fixturepkg import mod1", "mod1")
assert import_statement in importer.search("mod1", exact_match=True)
assert import_statement in importer.search("mo")
assert import_statement in importer.search("mod1")


class AutoImportObservingTest(unittest.TestCase):
Expand Down

0 comments on commit 4deab03

Please sign in to comment.