Pass in project directory when tasks module contains explicit namespace. #243

Merged
merged 1 commit into from May 5, 2015

Projects

None yet

2 participants

@gtback
Contributor
gtback commented May 5, 2015

When a tasks.py module contains an explict Collection (named either ns
or namespace), the parent directory (used to find the project-specific
configuration file (e.g. invoke.yaml) is not passed in to the
Collection created from the factory method Collection.from_module.
This caused the file to not be found except when explicitly specified
with the -f flag. Compare to the similar Collection() invocation about
12 lines below this change.

Fix #234.

@gtback gtback Pass in project directory when tasks module contains explicit namespace.
When a `tasks.py` module contains an explict Collection (named either `ns`
or `namespace`), the parent directory (used to find the project-specific
configuration file (e.g. `invoke.yaml`) is not passed in to the
Collection created from the factory method `Collection.from_module`.
This caused the file to not be found except when explicitly specified
with the -f flag. Compare to the similar Collection() invocation about
12 lines below this change.

Fix #234.
34e6a7a
@gtback
Contributor
gtback commented May 5, 2015

I'm happy to add a test for this, but I'm not sure the best place to, since it relies on having both tasks.py and invoke.yaml in the same directory. Trying to solve this is what led me down the path to #240, but I don't think there's a good unit test for this problem. An integration test, perhaps?

@bitprophet
Member

Naw, there was actually a regular semi-unit test (the ones in the CLI module are in a gray area between unit and integration) that can be copied to work perfectly for this, just needed a new fixture & a tweak to select it; see 3356f62

@bitprophet bitprophet merged commit 34e6a7a into pyinvoke:master May 5, 2015

2 checks passed

continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@gtback gtback deleted the gtback:load-project-config branch May 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment