Skip to content

Commit

Permalink
update ci (#82)
Browse files Browse the repository at this point in the history
* update ci

* Update .travis.yml

* Update .appveyor.yml

* Update .appveyor.yml

* oldmebestme

* .

* Update restructuredtext.py

* Update test_restructuredtext.py
  • Loading branch information
ofek committed Oct 20, 2019
1 parent c00183d commit d743e3e
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 42 deletions.
15 changes: 12 additions & 3 deletions .appveyor.yml
@@ -1,7 +1,18 @@
image: Visual Studio 2017
build: off
test: off
cache:
- '%LOCALAPPDATA%\pip\Cache'

skip_branch_with_pr: true
branches:
only:
- master

environment:
matrix:
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36-x64"
- PYTHON: "C:\\Python37-x64"

init:
- set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
Expand All @@ -10,8 +21,6 @@ install:
- "python -m pip install pytest parse toml"
- "python -m pip install -e ."

build: off

test_script:
- "python -m hatch conda ~\\miniconda"
- "for /f %%i in ('python -m hatch conda --show ~/miniconda') do set PATH=%PATH%;%%i"
Expand Down
16 changes: 11 additions & 5 deletions .travis.yml
@@ -1,17 +1,23 @@
language: python

branches:
only:
- master

matrix:
include:
- python: 3.5
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
- python: pypy3.5-5.8.0
- python: 3.7
env: TOXENV=py37
- python: 3.8
env: TOXENV=py38
- python: pypy3
env: TOXENV=pypy3
- language: generic
os: osx
osx_image: xcode8.3
env: TOXENV=py36
osx_image: xcode10.1
env: TOXENV=py37
before_install:
- brew update
- pip uninstall virtualenv || true
Expand Down
6 changes: 3 additions & 3 deletions hatch/files/readme/restructuredtext.py
Expand Up @@ -3,9 +3,7 @@
TEMPLATE = """\
{title}
{header_marker}
{badges}-----
.. contents:: **Table of Contents**
{badges}.. contents:: **Table of Contents**
:backlinks: none
Installation
Expand Down Expand Up @@ -69,6 +67,8 @@ def __init__(self, package_name, pyversions, licenses, badges):
for badge in badges:
badge_data += ReStructuredTextReadme.format_badge(badge)

badge_data += '\n-----\n'

# For testing we use https://github.com/r1chardj0n3s/parse and its
# `parse` function breaks on empty inputs.
badge_data += '\n'
Expand Down
47 changes: 19 additions & 28 deletions tests/commands/test_release.py
Expand Up @@ -12,7 +12,6 @@

PACKAGE_NAME = 'e00f69943529ccc38058'
USERNAME = 'Ofekmeister'
ENV_VARS = {'TWINE_PASSWORD': 'badpwbestpw'}


@requires_internet
Expand All @@ -23,8 +22,7 @@ def test_cwd():
runner.invoke(hatch, ['build'])
os.chdir(os.path.join(d, 'dist'))

with env_vars(ENV_VARS):
result = runner.invoke(hatch, ['release', '-u', USERNAME, '-t'])
result = runner.invoke(hatch, ['release', '-u', USERNAME, '-t'])

assert result.exit_code == 0

Expand All @@ -40,7 +38,7 @@ def test_username_env():
settings = copy_default_settings()
settings['pypi_username'] = ''
save_settings(settings)
extra_env_vars = {'TWINE_USERNAME': USERNAME, **ENV_VARS}
extra_env_vars = {'TWINE_USERNAME': USERNAME}
with env_vars(extra_env_vars):
result = runner.invoke(hatch, ['release', '-t'])

Expand All @@ -53,8 +51,7 @@ def test_cwd_dist_exists():
runner.invoke(hatch, ['init', PACKAGE_NAME, '--basic', '-ne'])
runner.invoke(hatch, ['build'])

with env_vars(ENV_VARS):
result = runner.invoke(hatch, ['release', '-u', USERNAME, '-t'])
result = runner.invoke(hatch, ['release', '-u', USERNAME, '-t'])

assert result.exit_code == 0

Expand All @@ -70,7 +67,7 @@ def test_package():
venv_dir = os.path.join(d, 'venv')
create_venv(venv_dir)

with venv(venv_dir, evars=ENV_VARS):
with venv(venv_dir):
os.chdir(package_dir)
install_packages(['-e', '.'])
os.chdir(d)
Expand All @@ -86,7 +83,7 @@ def test_package_not_exist():
venv_dir = os.path.join(d, 'venv')
create_venv(venv_dir)

with venv(venv_dir, evars=ENV_VARS):
with venv(venv_dir):
result = runner.invoke(hatch, ['release', PACKAGE_NAME, '-u', USERNAME, '-t'])

assert result.exit_code == 1
Expand All @@ -104,7 +101,7 @@ def test_local():
venv_dir = os.path.join(d, 'venv')
create_venv(venv_dir)

with venv(venv_dir, evars=ENV_VARS):
with venv(venv_dir):
install_packages(['-e', package_dir])
result = runner.invoke(hatch, ['release', '-l', '-u', USERNAME, '-t'])

Expand Down Expand Up @@ -154,8 +151,7 @@ def test_path_relative():
runner.invoke(hatch, ['init', PACKAGE_NAME, '--basic', '-ne'])
runner.invoke(hatch, ['build'])

with env_vars(ENV_VARS):
result = runner.invoke(hatch, ['release', '-p', 'dist', '-u', USERNAME, '-t'])
result = runner.invoke(hatch, ['release', '-p', 'dist', '-u', USERNAME, '-t'])

print(result.output)
assert result.exit_code == 0
Expand All @@ -171,8 +167,7 @@ def test_path_full():
build_dir = os.path.join(d, PACKAGE_NAME, 'dist')

os.chdir(os.path.join(d, 'ko'))
with env_vars(ENV_VARS):
result = runner.invoke(hatch, ['release', '-p', build_dir, '-u', USERNAME, '-t'])
result = runner.invoke(hatch, ['release', '-p', build_dir, '-u', USERNAME, '-t'])

assert result.exit_code == 0

Expand Down Expand Up @@ -200,8 +195,7 @@ def test_config_username():
settings = copy_default_settings()
settings['pypi_username'] = USERNAME
save_settings(settings)
with env_vars(ENV_VARS):
result = runner.invoke(hatch, ['release', '-p', 'dist', '-t'])
result = runner.invoke(hatch, ['release', '-p', 'dist', '-t'])

assert result.exit_code == 0

Expand All @@ -213,8 +207,7 @@ def test_config_not_exist():
runner.invoke(hatch, ['build'])

with temp_move_path(SETTINGS_FILE, d):
with env_vars(ENV_VARS):
result = runner.invoke(hatch, ['release', '-p', 'dist', '-t'])
result = runner.invoke(hatch, ['release', '-p', 'dist', '-t'])

assert result.exit_code == 1
assert 'Unable to locate config file. Try `hatch config --restore`.' in result.output
Expand All @@ -230,8 +223,7 @@ def test_config_username_empty():
settings = copy_default_settings()
settings['pypi_username'] = ''
save_settings(settings)
with env_vars(ENV_VARS):
result = runner.invoke(hatch, ['release', '-p', 'dist', '-t'])
result = runner.invoke(hatch, ['release', '-p', 'dist', '-t'])

assert result.exit_code == 1
assert (
Expand All @@ -246,8 +238,7 @@ def test_strict():
runner.invoke(hatch, ['init', PACKAGE_NAME, '--basic', '-ne'])
runner.invoke(hatch, ['build'])

with env_vars(ENV_VARS):
result = runner.invoke(hatch, ['release', '-p', 'dist', '-u', USERNAME, '-t', '-s'])
result = runner.invoke(hatch, ['release', '-p', 'dist', '-u', USERNAME, '-t', '-s'])

assert result.exit_code == 1

Expand All @@ -264,7 +255,7 @@ def test_repository_local():

# Make sure there's no configuration
with temp_move_path(os.path.expanduser("~/.pypirc"), d):
with venv(venv_dir, evars=ENV_VARS):
with venv(venv_dir):
install_packages(['-e', package_dir])
# Will error, since there's no configuration parameter for
# this URL
Expand All @@ -284,7 +275,7 @@ def test_repository_url_local():
venv_dir = os.path.join(d, 'venv')
create_venv(venv_dir)

with venv(venv_dir, evars=ENV_VARS):
with venv(venv_dir):
install_packages(['-e', package_dir])
result = runner.invoke(hatch, ['release', '-l', '-u', USERNAME,
'--repo-url', TEST_REPOSITORY])
Expand All @@ -303,7 +294,7 @@ def test_repository_and_repository_url_local():
venv_dir = os.path.join(d, 'venv')
create_venv(venv_dir)

with venv(venv_dir, evars=ENV_VARS):
with venv(venv_dir):
install_packages(['-e', package_dir])
result = runner.invoke(hatch, ['release', '-l', '-u', USERNAME,
'--repo', TEST_REPOSITORY,
Expand All @@ -322,7 +313,7 @@ def test_repository_env_vars():
venv_dir = os.path.join(d, 'venv')
create_venv(venv_dir)

extra_env_vars = {'TWINE_REPOSITORY': TEST_REPOSITORY, 'TWINE_REPOSITORY_URL': TEST_REPOSITORY, **ENV_VARS}
extra_env_vars = {'TWINE_REPOSITORY': TEST_REPOSITORY, 'TWINE_REPOSITORY_URL': TEST_REPOSITORY}
with venv(venv_dir, evars=extra_env_vars):
install_packages(['-e', package_dir])
result = runner.invoke(hatch, ['release', '-l', '-u', USERNAME])
Expand All @@ -341,7 +332,7 @@ def test_repository_and_test():
venv_dir = os.path.join(d, 'venv')
create_venv(venv_dir)

with venv(venv_dir, evars=ENV_VARS):
with venv(venv_dir):
install_packages(['-e', package_dir])
result = runner.invoke(hatch, ['release', '-l', '-u', USERNAME,
'-r', TEST_REPOSITORY,
Expand All @@ -350,15 +341,15 @@ def test_repository_and_test():
assert result.exit_code == 1
assert "Cannot specify both --test and --repo." in result.output

with venv(venv_dir, evars=ENV_VARS):
with venv(venv_dir):
result = runner.invoke(hatch, ['release', '-l', '-u', USERNAME,
'--repo-url', TEST_REPOSITORY,
'-t'])

assert result.exit_code == 1
assert "Cannot specify both --test and --repo-url." in result.output

with venv(venv_dir, evars=ENV_VARS):
with venv(venv_dir):
result = runner.invoke(hatch, ['release', '-l', '-u', USERNAME,
'-r', TEST_REPOSITORY,
'-ru', TEST_REPOSITORY,
Expand Down
3 changes: 3 additions & 0 deletions tests/files/readme/test_restructuredtext.py
Expand Up @@ -179,6 +179,7 @@ def test_badges_single():
'.. image:: https://img.shields.io/pypi/v/ok.svg\n'
' :target: https://pypi.org/project/ok\n'
' :alt: Latest PyPI version\n'
'\n-----\n'
'\n'
)

Expand Down Expand Up @@ -213,6 +214,7 @@ def test_badges_multiple():
'.. image:: https://img.shields.io/pypi/l/ok.svg\n'
' :target: https://choosealicense.com/licenses\n'
' :alt: License\n'
'\n-----\n'
'\n'
)

Expand Down Expand Up @@ -249,5 +251,6 @@ def test_badges_params():
'.. image:: https://img.shields.io/pypi/l/ok.svg?style=flat-square\n'
' :target: https://choosealicense.com/licenses\n'
' :alt: License\n'
'\n-----\n'
'\n'
)
4 changes: 1 addition & 3 deletions tox.ini
@@ -1,8 +1,6 @@
[tox]
envlist =
py35,
py36,
pypy3,
py{36,37,38,py3}

[testenv]
passenv = *
Expand Down

0 comments on commit d743e3e

Please sign in to comment.