Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ call mkdir "%CFG_ROOT_DIR%tmp"
call curl -o "%CFG_ROOT_DIR%tmp\virtualenv.pyz" https://bootstrap.pypa.io/virtualenv.pyz
call %PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%tmp\virtualenv.pyz" "%CFG_ROOT_DIR%tmp"
call "%CFG_ROOT_DIR%tmp\Scripts\activate"
call "%CFG_ROOT_DIR%tmp\Scripts\pip" install --upgrade pip virtualenv setuptools wheel
call "%PYTHON_EXECUTABLE%" -m pip install --upgrade pip virtualenv setuptools wheel
call "%CFG_ROOT_DIR%tmp\Scripts\pip" install -e .[testing]

@rem Return a proper return code on failure
Expand Down
23 changes: 12 additions & 11 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from deltacode import DeltaCode
from deltacode import utils

TERMINAL_WIDTH = 1000

def load_csv(location):
"""
Expand Down Expand Up @@ -82,7 +83,7 @@ def test_json_output_option_selected_all_selected(self):
result_file = self.get_temp_file('json')

runner = CliRunner()
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-j', result_file, '-a'])
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-j', result_file, '-a'], terminal_width=TERMINAL_WIDTH)
Comment thread
Hritik14 marked this conversation as resolved.

assert result.exit_code == 0

Expand Down Expand Up @@ -248,7 +249,7 @@ def test_json_output_option_selected_all_not_selected(self):
result_file = self.get_temp_file('json')

runner = CliRunner()
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-j', result_file])
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-j', result_file], terminal_width=TERMINAL_WIDTH)

assert result.exit_code == 0

Expand Down Expand Up @@ -350,7 +351,7 @@ def test_no_output_option_selected_all_selected(self):
old_scan = self.get_test_loc('cli/scan_1_file_moved_old.json')

runner = CliRunner()
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-a'])
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-a'], terminal_width=TERMINAL_WIDTH)

assert result.exit_code == 0

Expand Down Expand Up @@ -392,7 +393,7 @@ def test_no_output_option_selected_all_not_selected(self):
old_scan = self.get_test_loc('cli/scan_1_file_moved_old.json')

runner = CliRunner()
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan])
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan], terminal_width=TERMINAL_WIDTH)

assert result.exit_code == 0

Expand Down Expand Up @@ -434,7 +435,7 @@ def test_json_deltas_count_all_selected(self):
result_file = self.get_temp_file('json')

runner = CliRunner()
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-j', result_file, '-a'])
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-j', result_file, '-a'], terminal_width=TERMINAL_WIDTH)

json_result = json.load(open(result_file))

Expand All @@ -447,15 +448,15 @@ def test_json_deltas_count_all_not_selected(self):
result_file = self.get_temp_file('json')

runner = CliRunner()
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-j', result_file])
result = runner.invoke(cli.cli, ['-n', new_scan, '-o', old_scan, '-j', result_file], terminal_width=TERMINAL_WIDTH)

json_result = json.load(open(result_file))

assert json_result.get('deltas_count') == 4

def test_help(self):
runner = CliRunner()
result = runner.invoke(cli.cli, ['--help'])
result = runner.invoke(cli.cli, ['--help'], terminal_width=TERMINAL_WIDTH)

assert 'Usage: cli [OPTIONS]' in result.output
assert 'Identify the changes that need to be made' in result.output
Expand All @@ -465,19 +466,19 @@ def test_help(self):

def test_version(self):
runner = CliRunner()
result = runner.invoke(cli.cli, ['--version'])
result = runner.invoke(cli.cli, ['--version'], terminal_width=TERMINAL_WIDTH)

assert 'DeltaCode version' in result.output

def test_empty(self):
runner = CliRunner()
result = runner.invoke(cli.cli, [])
result = runner.invoke(cli.cli, [], terminal_width=TERMINAL_WIDTH)

assert 'Usage: cli [OPTIONS]' in result.output
assert "Error: Missing option '-n' / '--new'." in result.output

def test_incorrect_flag(self):
runner = CliRunner()
result = runner.invoke(cli.cli, ['-xyz'])
result = runner.invoke(cli.cli, ['-xyz'], terminal_width=TERMINAL_WIDTH)

assert 'Error: no such option: -x' in result.output
assert 'Error: No such option: -x' in result.output