Update pre-commit and get tests passing

This commit is contained in:
IamTheFij 2022-01-05 20:25:58 -08:00
parent 764d0f9e3a
commit c2ae14d48c
7 changed files with 31 additions and 34 deletions

View File

@ -8,10 +8,6 @@ PYTHON_VERSIONS = [
"latest",
]
PYPY3_VERSIONS = [
"3",
]
def main(ctx):
pipelines = []
@ -48,9 +44,6 @@ def tests():
"steps": [
tox_step("python:"+version)
for version in PYTHON_VERSIONS
] + [
tox_step("pypy:"+version, "pypy3", "pypy3")
for version in PYPY3_VERSIONS
],
}]
@ -121,7 +114,7 @@ def push_to_pypi():
"trigger": {
"event": ["tag"],
"ref": [
"refs/heads/master",
"refs/heads/main",
"refs/tags/v*",
],
},

View File

@ -1,13 +1,11 @@
---
default_language_version:
python: python3.8
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 21.12b0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
@ -17,10 +15,12 @@ repos:
- id: name-tests-test
exclude: tests/(common.py|util.py|(helpers|integration/factories)/(.+).py)
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.4.0
rev: v2.6.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.800
rev: v0.930
hooks:
- id: mypy
exclude: docs/
additional_dependencies: [ "types-requests" ]

View File

@ -1,6 +1,6 @@
OPEN_CMD := $(shell type xdg-open &> /dev/null && echo 'xdg-open' || echo 'open')
NAME := release-gitter
ENV := env
ENV := venv
.PHONY: default
default: test

View File

@ -3,9 +3,7 @@
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
@ -13,13 +11,11 @@
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'release-gitter'
copyright = '2021, iamthefij'
author = 'iamthefij'
project = "release-gitter"
copyright = "2021, iamthefij"
author = "iamthefij"
# -- General configuration ---------------------------------------------------
@ -27,11 +23,10 @@ author = 'iamthefij'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@ -44,9 +39,9 @@ exclude_patterns = []
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = "alabaster"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

View File

@ -21,6 +21,7 @@ import requests
# Extract metadata from repo
class InvalidRemoteError(ValueError):
pass
@ -36,7 +37,9 @@ class GitRemoteInfo:
Currently only supporting Github and Gitea APIs"""
if self.hostname == "github.com":
return f"https://api.{self.hostname}/repos/{self.owner}/{self.repo}/releases"
return (
f"https://api.{self.hostname}/repos/{self.owner}/{self.repo}/releases"
)
# Try to detect an api
swagger_uri = f"https://{self.hostname}/swagger.v1.json"
@ -73,7 +76,9 @@ def get_git_remote(git_url: Optional[str] = None) -> GitRemoteInfo:
if git_url.startswith("git@github.com:"):
git_ssh_parts = git_url.partition(":")
if not all(git_ssh_parts):
raise InvalidRemoteError(f"Could not parse URL {git_url}. Is this an ssh url?")
raise InvalidRemoteError(
f"Could not parse URL {git_url}. Is this an ssh url?"
)
git_url = f"ssh://{git_ssh_parts[0]}/{git_ssh_parts[2]}"
u = urlparse(git_url)
@ -82,7 +87,9 @@ def get_git_remote(git_url: Optional[str] = None) -> GitRemoteInfo:
path = u.path.split("/")
if len(path) < 3 or not all(path[1:3]):
raise InvalidRemoteError(f"{path[1:3]} Could not parse owner and repo from URL {git_url}")
raise InvalidRemoteError(
f"{path[1:3]} Could not parse owner and repo from URL {git_url}"
)
return GitRemoteInfo(u.hostname, path[1], path[2].removesuffix(".git"))

View File

@ -17,7 +17,9 @@ setup(
long_description=long_description,
long_description_content_type="text/markdown",
url="https://git.iamthefij.com/iamthefij/release-gitter.git",
download_url=("https://git.iamthefij.com/iamthefij/release-gitter.git/archive/master.tar.gz"),
download_url=(
"https://git.iamthefij.com/iamthefij/release-gitter.git/archive/master.tar.gz"
),
author="iamthefij",
author_email="",
classifiers=[

View File

@ -1,13 +1,13 @@
[tox]
envlist = py3,pypy3
envlist = py3
[testenv]
deps =
-rrequirements-dev.txt
commands =
coverage erase
coverage run --source=release_gitter/ -m pytest --capture=no -vv {posargs:tests}
coverage report -m --fail-under 70
coverage run --source=release_gitter -m unittest discover . {posargs:"*_test.py"}
# coverage report -m --fail-under 70
pre-commit run --all-files
[testenv:pre-commit]