Skip to content

Commit

Permalink
Merge branch '2.0' into 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bitprophet committed May 2, 2023
2 parents 9b68e30 + d6c58d2 commit d59f913
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/_support/namespacing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from invoke import Collection, task, call

from package import module
from subspace import module


@task
Expand Down
5 changes: 5 additions & 0 deletions tests/_support/package/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from invoke import Collection

from . import module

ns = Collection(module)
5 changes: 5 additions & 0 deletions tests/_support/subspace/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from invoke import Collection

from . import module

ns = Collection(module)
6 changes: 6 additions & 0 deletions tests/_support/subspace/module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from invoke import task


@task
def mytask(c):
pass
11 changes: 8 additions & 3 deletions tests/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
from importlib.util import spec_from_file_location
from types import ModuleType
from pathlib import Path

from pytest import raises

Expand Down Expand Up @@ -50,7 +51,7 @@ def adds_module_parent_dir_to_sys_path(self):
# Crummy doesn't-explode test.
_BasicLoader().load("namespacing")

def doesnt_dupliate_parent_dir_addition(self):
def doesnt_duplicate_parent_dir_addition(self):
_BasicLoader().load("namespacing")
_BasicLoader().load("namespacing")
# If the bug is present, this will be 2 at least (and often more, since
Expand All @@ -59,8 +60,12 @@ def doesnt_dupliate_parent_dir_addition(self):

def can_load_package(self):
loader = _BasicLoader()
# make sure it doesn't explode
loader.load("package")
# Load itself doesn't explode (tests 'from . import xxx' internally)
mod, loc = loader.load("package")
# Properties of returned values look as expected
package = Path(support) / "package"
assert loc == str(package)
assert mod.__file__ == str(package / "__init__.py")

def load_name_defaults_to_config_tasks_collection_name(self):
"load() name defaults to config.tasks.collection_name"
Expand Down

0 comments on commit d59f913

Please sign in to comment.