-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use platform-agnostic path manipulation in test_packages.py (#366)
- Loading branch information
Showing
1 changed file
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ def _create_pkg_in_dir(path, version='0.1.0'): | |
<maintainer email="[email protected]">Foo Bar</maintainer> | ||
</package> | ||
""".format(path.split('/')[-1], version) | ||
""".format(os.path.basename(path), version) | ||
|
||
with open(os.path.join(path, 'package.xml'), 'w+') as f: | ||
f.write(template) | ||
|
@@ -52,10 +52,10 @@ def test_find_packages_allowing_duplicates_with_no_packages(): | |
@in_temporary_directory | ||
def test_find_packages_invalid_version(): | ||
version = ':{version}' | ||
path = 'src/foo' | ||
path = os.path.join('src', 'foo') | ||
_create_pkg_in_dir(path, version) | ||
try: | ||
find_packages(path.split('/')[0]) | ||
find_packages(os.path.dirname(path)) | ||
assert False, 'Must raise' | ||
except InvalidPackage as e: | ||
exception_message = str(e) | ||
|