-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from sbidoul/ref-oca_list_addons_to_test_as_reqs
Avoid conflict between addons in test-requirements.txt and local repo
- Loading branch information
Showing
4 changed files
with
92 additions
and
8 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
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
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
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import subprocess | ||
import textwrap | ||
|
||
from .common import make_addons_dir, make_addon_dist_name | ||
|
||
|
||
def test_oca_list_addons_to_test_as_url_reqs__basic(): | ||
"""Basic successful test.""" | ||
with make_addons_dir( | ||
["addon_success", "addon_with_deb_dep", "uninstallable_addon"] | ||
) as addons_dir: | ||
result = subprocess.check_output( | ||
["oca_list_addons_to_test_as_url_reqs"], cwd=addons_dir, text=True | ||
) | ||
assert result == textwrap.dedent( | ||
f"""\ | ||
{make_addon_dist_name('addon_success')} @ {addons_dir.as_uri()}/addon_success | ||
{make_addon_dist_name('addon_with_deb_dep')} @ {addons_dir.as_uri()}/addon_with_deb_dep | ||
""" | ||
) | ||
|
||
|
||
def test_oca_list_addons_to_test_as_url_reqs__editable(): | ||
"""Basic successful test with editables.""" | ||
with make_addons_dir( | ||
["addon_success", "addon_with_deb_dep", "uninstallable_addon"] | ||
) as addons_dir: | ||
result = subprocess.check_output( | ||
["oca_list_addons_to_test_as_url_reqs", "--editable"], | ||
cwd=addons_dir, | ||
text=True, | ||
) | ||
assert result == textwrap.dedent( | ||
f"""\ | ||
-e {addons_dir.as_uri()}/addon_success#egg={make_addon_dist_name('addon_success')} | ||
-e {addons_dir.as_uri()}/addon_with_deb_dep#egg={make_addon_dist_name('addon_with_deb_dep')} | ||
""" | ||
) | ||
|
||
|
||
def test_oca_list_addons_to_test_as_url_reqs__skip_test_requirement(): | ||
"""Basic successful test.""" | ||
with make_addons_dir( | ||
["addon_success", "addon_with_deb_dep", "uninstallable_addon"] | ||
) as addons_dir: | ||
# add URL reference to addon_success | ||
addons_dir.joinpath("test-requirements.txt").write_text( | ||
f"{make_addon_dist_name('addon_success')} @ git+https://github.com/oca/dummy@refs/pull/123/head" | ||
) | ||
result = subprocess.check_output( | ||
["oca_list_addons_to_test_as_url_reqs"], cwd=addons_dir, text=True | ||
) | ||
# addon_success should not be in result because it is already in test-requirements.txt | ||
assert result == textwrap.dedent( | ||
f"""\ | ||
{make_addon_dist_name('addon_with_deb_dep')} @ {addons_dir.as_uri()}/addon_with_deb_dep | ||
""" | ||
) |