From 5d2ac853136625078241923b63c5500afc7ed58d Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Sun, 29 Mar 2020 23:20:05 +0200 Subject: [PATCH] Deletes commented code and simplifies a couple of assert --- tests/test_bake_project.py | 50 +++----------------------------------- 1 file changed, 3 insertions(+), 47 deletions(-) diff --git a/tests/test_bake_project.py b/tests/test_bake_project.py index f50426273..75d828867 100644 --- a/tests/test_bake_project.py +++ b/tests/test_bake_project.py @@ -88,7 +88,6 @@ def test_bake_and_run_tests(cookies): with bake_in_temp_dir(cookies) as result: assert result.project.isdir() run_inside_dir('python setup.py test', str(result.project)) == 0 - print("test_bake_and_run_tests path", str(result.project)) def test_bake_withspecialchars_and_run_tests(cookies): @@ -111,26 +110,6 @@ def test_bake_with_apostrophe_and_run_tests(cookies): run_inside_dir('python setup.py test', str(result.project)) == 0 -# def test_bake_and_run_travis_pypi_setup(cookies): -# # given: -# with bake_in_temp_dir(cookies) as result: -# project_path = str(result.project) -# -# # when: -# travis_setup_cmd = ('python travis_pypi_setup.py' -# ' --repo audreyr/cookiecutter-pypackage' -# ' --password invalidpass') -# run_inside_dir(travis_setup_cmd, project_path) -# # then: -# result_travis_config = yaml.load( -# result.project.join(".travis.yml").open() -# ) -# min_size_of_encrypted_password = 50 -# assert len( -# result_travis_config["deploy"]["password"]["secure"] -# ) > min_size_of_encrypted_password - - def test_bake_without_travis_pypi_setup(cookies): with bake_in_temp_dir( cookies, @@ -217,8 +196,7 @@ def test_using_pytest(cookies): test_file_path = result.project.join( 'tests/test_python_boilerplate.py' ) - lines = test_file_path.readlines() - assert "import pytest" in ''.join(lines) + assert "import pytest" in test_file_path.read() # Test the new pytest target run_inside_dir('python setup.py pytest', str(result.project)) == 0 # Test the test alias (which invokes pytest) @@ -231,30 +209,8 @@ def test_not_using_pytest(cookies): test_file_path = result.project.join( 'tests/test_python_boilerplate.py' ) - lines = test_file_path.readlines() - assert "import unittest" in ''.join(lines) - assert "import pytest" not in ''.join(lines) - - -# def test_project_with_hyphen_in_module_name(cookies): -# result = cookies.bake( -# extra_context={'project_name': 'something-with-a-dash'} -# ) -# assert result.project is not None -# project_path = str(result.project) -# -# # when: -# travis_setup_cmd = ('python travis_pypi_setup.py' -# ' --repo audreyr/cookiecutter-pypackage' -# ' --password invalidpass') -# run_inside_dir(travis_setup_cmd, project_path) -# -# # then: -# result_travis_config = yaml.load( -# open(os.path.join(project_path, ".travis.yml")) -# ) -# assert "secure" in result_travis_config["deploy"]["password"],\ -# "missing password config in .travis.yml" + assert "import unittest" in test_file_path.read() + assert "import pytest" not in test_file_path.read() def test_bake_with_no_console_script(cookies):