Skip to content

Commit

Permalink
First pass at removing travis_pypi_setup.py per #410
Browse files Browse the repository at this point in the history
  • Loading branch information
pydanny committed Feb 18, 2018
1 parent 2dbdf81 commit 1b4aa73
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Config file for automatic testing at travis-ci.org
# This file will be regenerated if you run travis_pypi_setup.py

language: python
python:
Expand All @@ -14,8 +13,7 @@ install: pip install -U tox-travis
# command to run tests, e.g. python setup.py test
script: tox

# After you create the Github repo and add it to Travis, run the
# travis_pypi_setup.py script to finish PyPI deployment setup
# deploy new versions to PyPI
deploy:
provider: pypi
distributions: sdist bdist_wheel
Expand Down
54 changes: 27 additions & 27 deletions tests/test_bake_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,19 @@ 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_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):
Expand Down Expand Up @@ -197,20 +197,20 @@ def test_not_using_pytest(cookies):
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"
# 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"


def test_bake_with_no_console_script(cookies):
Expand Down

1 comment on commit 1b4aa73

@tdamsma
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pydanny, I was just skipping through the tests and saw some commented out code. Are you aware there is a nice way to annotate troublesome tests with pytest to clearly communicate why and what is failing? Something like:

@pytest.mark.skipif(sys.version_info < (3,6),
                reason="requires python3.6")

See the docs here: https://docs.pytest.org/en/latest/skipping.html

Please sign in to comment.