From f1e9969a8843c493fd5155066cf35bf33b937384 Mon Sep 17 00:00:00 2001 From: arimbr Date: Sun, 15 Oct 2017 23:54:26 +0200 Subject: [PATCH] Add tests for bonobo init new directory and init within empty directory --- tests/test_commands.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_commands.py b/tests/test_commands.py index a29465c..e9ba1bd 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1,6 +1,7 @@ import os import runpy import sys +import shutil from unittest.mock import patch import pkg_resources @@ -43,6 +44,27 @@ def test_no_command(runner, capsys): assert 'error: the following arguments are required: command' in err +@all_runners +def test_init(runner, capsys): + runner('init', 'project-name') + out, err = capsys.readouterr() + out = out.strip() + shutil.rmtree('project-name') + assert out == '' + + +@all_runners +def test_init_within_empty_directory(runner, capsys): + os.mkdir('empty-directory') + os.chdir('empty-directory') + runner('init', '.') + out, err = capsys.readouterr() + out = out.strip() + os.chdir('..') + shutil.rmtree('empty-directory') + assert out == '' + + @all_runners def test_run(runner, capsys): runner('run', '--quiet', get_examples_path('types/strings.py'))