Support for python3.7 and python3.8
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Added tox targets as well
This commit is contained in:
parent
1b74126494
commit
3f23ddd3cc
@ -2,6 +2,8 @@
|
||||
This builder functions as a pseudo builder that instead downloads and installs a binary file using
|
||||
release-gitter based on a pyproject.toml file. It's a total hack...
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
from shutil import copytree
|
||||
from shutil import move
|
||||
|
@ -1,4 +1,6 @@
|
||||
#! /usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import platform
|
||||
from collections.abc import Sequence
|
||||
@ -91,7 +93,14 @@ def parse_git_remote(git_url: Optional[str] = None) -> GitRemoteInfo:
|
||||
f"{path[1:3]} Could not parse owner and repo from URL {git_url}"
|
||||
)
|
||||
|
||||
return GitRemoteInfo(u.hostname, path[1], path[2].removesuffix(".git"))
|
||||
repo = path[2]
|
||||
try:
|
||||
repo = repo.removesuffix(".git") # type: ignore
|
||||
except AttributeError:
|
||||
# Py < 3.9
|
||||
repo = repo[: -len(".git")] if repo and repo.endswith(".git") else repo
|
||||
|
||||
return GitRemoteInfo(u.hostname, path[1], repo)
|
||||
|
||||
|
||||
def parse_cargo_version(p: Path) -> str:
|
||||
|
@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
@ -111,27 +113,23 @@ class TestVersionInfo(unittest.TestCase):
|
||||
version = release_gitter.read_version()
|
||||
self.assertIsNone(version)
|
||||
|
||||
def test_cargo_file_has_version(self):
|
||||
with (
|
||||
patch("pathlib.Path.exists", return_value=True),
|
||||
patch(
|
||||
"pathlib.Path.open",
|
||||
mock_open(read_data="\n".join(["[package]", 'version = "1.0.0"'])),
|
||||
),
|
||||
):
|
||||
version = release_gitter.read_version()
|
||||
self.assertEqual(version, "1.0.0")
|
||||
@patch("pathlib.Path.exists", return_value=True)
|
||||
@patch(
|
||||
"pathlib.Path.open",
|
||||
mock_open(read_data="\n".join(["[package]", 'version = "1.0.0"'])),
|
||||
)
|
||||
def test_cargo_file_has_version(self, *_):
|
||||
version = release_gitter.read_version()
|
||||
self.assertEqual(version, "1.0.0")
|
||||
|
||||
def test_cargo_file_missing_version(self):
|
||||
with (
|
||||
patch("pathlib.Path.exists", return_value=True),
|
||||
patch(
|
||||
"pathlib.Path.open",
|
||||
mock_open(read_data="\n".join(["[package]"])),
|
||||
),
|
||||
):
|
||||
with self.assertRaises(ValueError):
|
||||
release_gitter.read_version()
|
||||
@patch("pathlib.Path.exists", return_value=True)
|
||||
@patch(
|
||||
"pathlib.Path.open",
|
||||
mock_open(read_data="\n".join(["[package]"])),
|
||||
)
|
||||
def test_cargo_file_missing_version(self, *_):
|
||||
with self.assertRaises(ValueError):
|
||||
release_gitter.read_version()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user