-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a way to exclude some modules from the result of dependencies
- Loading branch information
Showing
2 changed files
with
62 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from mock import patch, MagicMock | ||
from odoo_tools.cli.odot import command | ||
from odoo_tools.api.environment import Environment | ||
|
||
from odoo_tools.api.modules import ModuleApi | ||
from odoo_tools.api.objects import Manifest | ||
|
||
|
||
def test_module_deps(runner, tmp_path): | ||
|
||
with patch.object(ModuleApi, 'list') as list_modules: | ||
|
||
list_modules.return_value = [ | ||
Manifest(tmp_path / 'a', attrs={'version': 1, 'depends': {}}), | ||
Manifest(tmp_path / 'b', attrs={'version': 1, 'depends': {'a'}}), | ||
Manifest(tmp_path / 'c', attrs={'version': 1, 'depends': {'b'}}), | ||
Manifest( | ||
tmp_path / 'd', | ||
attrs={ | ||
'version': 1, | ||
'depends': {'a', 'c'} | ||
} | ||
) | ||
] | ||
|
||
result = runner.invoke( | ||
command, | ||
[ | ||
'module', | ||
'deps', | ||
'--only-name', | ||
'--exclude-modules', | ||
'--csv-modules', 'c,d', | ||
] | ||
) | ||
|
||
modules = set(result.stdout.strip().split('\n')) | ||
assert modules == {'a', 'b'} | ||
|
||
result = runner.invoke( | ||
command, | ||
[ | ||
'module', | ||
'deps', | ||
'--only-name', | ||
'--csv-modules', 'c,d', | ||
] | ||
) | ||
modules = set(result.stdout.strip().split('\n')) | ||
assert modules == {'a', 'b', 'c', 'd'} |