Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KED-1076] Add open flag to build-docs that opens the documentation on build #107

Merged
merged 12 commits into from
Oct 2, 2019
Prev Previous commit
Next Next commit
Patch shutil.rmtree in test in hopes it fixes Python3.5 problem
  • Loading branch information
mzjp2 committed Sep 28, 2019
commit 4bc9f63e9a633e598c4e981fb34b905029b4c9ab
6 changes: 5 additions & 1 deletion tests/template/test_kedro_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,18 @@ def test_happy_path(self, call_mock, python_call_mock, fake_kedro_cli, mocker):
fake_rmtree.assert_called_once_with("docs/build", ignore_errors=True)

@pytest.mark.parametrize("open_flag", ["-o", "--open"])
def test_open_docs(self, open_flag, call_mock, python_call_mock, fake_kedro_cli, mocker):
def test_open_docs(
self, open_flag, call_mock, python_call_mock, fake_kedro_cli, mocker
):
fake_rmtree = mocker.patch("shutil.rmtree")
patched_browser = mocker.patch("webbrowser.open")
result = CliRunner().invoke(fake_kedro_cli.cli, ["build-docs", open_flag])
assert not result.exit_code, result.stdout
patched_browser.assert_called_once()
args, _ = patched_browser.call_args
for each in ("file://", os.path.join("docs", "build", "html", "index.html")):
assert each in args[0]
fake_rmtree.assert_called_once_with("docs/build", ignore_errors=True)


class TestBuildReqsCommand:
Expand Down