def test_maybe_import_app(self, argv, expected_chdir, expected_app, *, group): with patch("os.chdir") as chdir: with patch("faust.cli.base.find_app") as find_app: group._maybe_import_app(argv) if expected_chdir: chdir.assert_called_once_with(Path(expected_chdir).absolute()) else: chdir.assert_not_called() if expected_app: find_app.assert_called_once_with(expected_app) else: find_app.assert_not_called()
def test_app_from_str(self, *, command): with patch('faust.cli.base.find_app') as find_app: res = command._app_from_str('foo') assert res is find_app.return_value find_app.assert_called_once_with('foo')