diff options
author | Marc Abramowitz <marc@marc-abramowitz.com> | 2014-04-28 09:35:11 -0700 |
---|---|---|
committer | Marc Abramowitz <marc@marc-abramowitz.com> | 2014-04-28 09:35:11 -0700 |
commit | adcb5b45141ad54afb19aea96d1bc979e0909e0d (patch) | |
tree | 01fe462d3c8ce540eaf3d240ac1db8ad2614b2bf | |
parent | 7fbfd9cba01d75655bf79256c545b84c6b6a3c2b (diff) | |
download | tox-adcb5b45141ad54afb19aea96d1bc979e0909e0d.tar.gz |
test_quickstart: Use multilines and add comments for better understanding
as suggested by Ronny Pfannschmidt at
https://bitbucket.org/hpk42/tox/pull-request/99/fix-test_quickstart-failures/diff#comment-1746221
-rw-r--r-- | tests/test_quickstart.py | 160 |
1 files changed, 139 insertions, 21 deletions
diff --git a/tests/test_quickstart.py b/tests/test_quickstart.py index 709fdc6..df8a98f 100644 --- a/tests/test_quickstart.py +++ b/tests/test_quickstart.py @@ -6,6 +6,7 @@ import tox._quickstart def cleandir(tmpdir): tmpdir.chdir() + class TestToxQuickstartMain(object): def mock_term_input_return_values(self, return_values): @@ -23,12 +24,26 @@ class TestToxQuickstartMain(object): return mock_term_input - def test_quickstart_main_choose_individual_pythons_and_pytest(self, - monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_pytest( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', self.get_mock_term_input( - ['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'py.test', 'pytest'])) + [ + '4', # Python versions: choose one by one + 'Y', # py26 + 'Y', # py27 + 'Y', # py32 + 'Y', # py33 + 'Y', # py34 + 'Y', # pypy + 'N', # jython + 'py.test', # command to run tests + 'pytest' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -49,11 +64,26 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_individual_pythons_and_nose_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_nose_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', - 'nosetests', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + 'Y', # py26 + 'Y', # py27 + 'Y', # py32 + 'Y', # py33 + 'Y', # py34 + 'Y', # pypy + 'N', # jython + 'nosetests', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -74,11 +104,26 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_individual_pythons_and_trial_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_trial_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', - 'trial', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + 'Y', # py26 + 'Y', # py27 + 'Y', # py32 + 'Y', # py33 + 'Y', # py34 + 'Y', # pypy + 'N', # jython + 'trial', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -99,11 +144,26 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_individual_pythons_and_pytest_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_pytest_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', - 'py.test', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + 'Y', # py26 + 'Y', # py27 + 'Y', # py32 + 'Y', # py33 + 'Y', # py34 + 'Y', # pypy + 'N', # jython + 'py.test', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) expected_tox_ini = """ @@ -123,10 +183,19 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_py27_and_pytest_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_py27_and_pytest_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['1', 'py.test', ''])) + self.get_mock_term_input( + [ + '1', # py27 + 'py.test', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -147,10 +216,19 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_py27_and_py33_and_pytest_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_py27_and_py33_and_pytest_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['2', 'py.test', ''])) + self.get_mock_term_input( + [ + '2', # py27 and py33 + 'py.test', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -171,10 +249,19 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_all_pythons_and_pytest_adds_deps(self, monkeypatch): + def test_quickstart_main_choose_all_pythons_and_pytest_adds_deps( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['3', 'py.test', ''])) + self.get_mock_term_input( + [ + '3', # all Python versions + 'py.test', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -195,10 +282,26 @@ deps = result = open('tox.ini').read() assert(result == expected_tox_ini) - def test_quickstart_main_choose_individual_pythons_and_defaults(self, monkeypatch): + def test_quickstart_main_choose_individual_pythons_and_defaults( + self, + monkeypatch): monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', '', '', '', '', '', '', '', '', '', '', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + '', # py26 + '', # py27 + '', # py32 + '', # py33 + '', # py34 + '', # pypy + '', # jython + '', # command to run tests + '' # test dependencies + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) @@ -228,7 +331,22 @@ deps = monkeypatch.setattr( tox._quickstart, 'term_input', - self.get_mock_term_input(['4', '', '', '', '', '', '', '', '', '', '', ''])) + self.get_mock_term_input( + [ + '4', # Python versions: choose one by one + '', # py26 + '', # py27 + '', # py32 + '', # py33 + '', # py34 + '', # pypy + '', # jython + '', # command to run tests + '', # test dependencies + '', # tox.ini already exists; overwrite? + ] + ) + ) tox._quickstart.main(argv=['tox-quickstart']) |