Update repo with latest hotness

Haven't touched this in a second. Update to python3 and stestr.
Drop py2, because sanity. Reformat with black because it's easy.
Replace tox with nox.

Add a gitreview and a zuul.yaml, since we live in Gerrit now.

Change-Id: I673a64e9680244ce9820c1683cd9a1d7906a6be3
This commit is contained in:
Monty Taylor 2024-06-02 11:40:53 +02:00
parent 3642338465
commit 3df738d481
13 changed files with 125 additions and 60 deletions

4
.gitignore vendored
View File

@ -26,8 +26,10 @@ cover/
.coverage*
!.coveragerc
.tox
.nox
nosetests.xml
.testrepository
.stestr
.venv
# Translations
@ -55,4 +57,4 @@ ChangeLog
.*sw?
# Files created by releasenotes build
releasenotes/build
releasenotes/build

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.opendev.org
port=29418
project=inaugust/ttrun.git

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./ttrun/tests
top_dir=./

View File

@ -1,7 +0,0 @@
[DEFAULT]
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

22
.zuul.yaml Normal file
View File

@ -0,0 +1,22 @@
- project:
vars:
release_python: python3
check:
jobs:
- nox-linters
- nox-py311:
nodeset: ubuntu-jammy
gate:
jobs:
- nox-linters
- nox-py311:
nodeset: ubuntu-jammy
- build-python-release:
nodeset: ubuntu-jammy
promote:
jobs:
- opendev-promote-python
release:
jobs:
- opendev-release-python:
nodeset: ubuntu-jammy

View File

@ -1,4 +0,0 @@
ttrun Style Commandments
===============================================
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/

58
noxfile.py Normal file
View File

@ -0,0 +1,58 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import nox
nox.options.error_on_external_run = True
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["tests-3", "docs", "linters"]
def install_deps(session):
session.install("-r", "requirements.txt")
session.install("-r", "test-requirements.txt")
session.install("-e", ".")
@nox.session(python="3")
def linters(session):
session.install("-r", "test-requirements.txt")
session.run("black", "ttrun")
session.run("flake8")
@nox.session(python="3")
def docs(session):
install_deps(session)
session.run(
"sphinx-build",
"-W",
"-d",
"doc/build/doctrees",
"-b",
"html",
"doc/source/",
"doc/build/html",
)
@nox.session(python="3")
def venv(session):
install_deps(session)
session.run(*session.posargs)
@nox.session(python="3")
def tests(session):
install_deps(session)
session.run("stestr", "run", "--color", *session.posargs)

View File

@ -5,17 +5,22 @@ description-file =
README.rst
author = Monty Taylor
author-email = mordred@inaugust.com
home-page = http://git.inaugust.com/cgit/ttrun/
home-page = https://opendev.org/inaugust/ttrun
classifier =
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
[files]
packages =
@ -27,3 +32,9 @@ console_scripts =
[wheel]
universal = 1
[flake8]
show-source = True
builtins = _
exclude=.venv,.git,.[nt]ox,dist,doc,*lib/python*,*egg,build
ignore=E501,W503

View File

@ -24,6 +24,4 @@ try:
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
setuptools.setup(setup_requires=["pbr"], pbr=True)

View File

@ -1,4 +1,7 @@
hacking<0.12,>=0.11.0
hacking>=3.0,<3.1 # Apache-2.0
python-subunit>=0.0.18
testrepository>=0.0.18
coverage>=4.0,!=4.4 # Apache-2.0
python-subunit>=0.0.18 # Apache-2.0/BSD
stestr>=1.0.0 # Apache-2.0
testtools>=1.4.0 # MIT
black

27
tox.ini
View File

@ -1,27 +0,0 @@
[tox]
minversion = 2.0
envlist = py35,py27,pep8
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py test --slowest --testr-args='{posargs}'
[testenv:pep8]
commands = flake8 {posargs}
[testenv:venv]
commands = {posargs}
[testenv:cover]
commands = python setup.py test --coverage --testr-args='{posargs}'
[flake8]
show-source = True
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build

View File

@ -18,5 +18,4 @@
import pbr.version
__version__ = pbr.version.VersionInfo(
'ttrun').version_string()
__version__ = pbr.version.VersionInfo("ttrun").version_string()

View File

@ -24,10 +24,10 @@ import testtools
def parse_arguments():
parser = argparse.ArgumentParser(
description='Simple CLI to run tests with testtools')
parser.add_argument(
'-e', dest='environment', help='tox environment to use')
parser.add_argument('tests', nargs='*', help='Tests to run')
description="Simple CLI to run tests with testtools"
)
parser.add_argument("-e", dest="environment", help="tox environment to use")
parser.add_argument("tests", nargs="*", help="Tests to run")
return parser.parse_args()
@ -35,14 +35,17 @@ def main():
args = parse_arguments()
if args.environment:
return subprocess.call([
'.tox/{environment}/bin/python'.format(
environment=args.environment),
'-m',
'testtools.run'] + args.tests)
return subprocess.call(
[
".tox/{environment}/bin/python".format(environment=args.environment),
"-m",
"testtools.run",
]
+ args.tests
)
else:
return testtools.run.main([sys.argv[0]] + args.tests, sys.stdout)
if __name__ == '__main__':
if __name__ == "__main__":
sys.exit(main())