Skip to content

Commit

Permalink
Merge branch 'main' into dynamic-schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish authored Jul 14, 2024
2 parents e23f8ed + 3862766 commit f7900e7
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 51 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
os: ["macOS-latest", "ubuntu-latest", "windows-latest"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-tests-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
Expand All @@ -42,13 +42,13 @@ jobs:
name: pep8
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-lint-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
Expand All @@ -64,13 +64,13 @@ jobs:
name: cover
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-lint-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
Expand All @@ -83,7 +83,7 @@ jobs:
- name: Run coverxml
run: tox -ecoverxml
- name: codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
files: ./cover/coverage.xml # optional
flags: unittests # optional
Expand All @@ -94,15 +94,15 @@ jobs:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-docs-${{ hashFiles('setup.py','requirements-dev.txt','constraints.txt') }}
Expand All @@ -114,7 +114,7 @@ jobs:
run: python -m pip install -U 'tox<4'
- name: Build Docs
run: tox -edocs
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: html_docs
path: docs/_build
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ jobs:
wheel-build:
name: Build and Publish Release Artifacts
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'
- name: Install Deps
run: pip install -U twine wheel
run: pip install -U wheel
- name: Build Artifacts
run: |
python setup.py sdist bdist_wheel
Expand All @@ -23,7 +26,4 @@ jobs:
with:
path: ./dist/stestr*
- name: Publish to PyPi
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: stestr-release
run: twine upload dist/stestr*
uses: pypa/gh-action-pypi-publish@release/v1
8 changes: 8 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ testtools>=2.2.0 # MIT
PyYAML>=3.10.0 # MIT
voluptuous>=0.8.9 # BSD License
tomlkit>=0.11.6 # MIT
extras>=1.0.0
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ classifier =
Operating System :: OS Independent
Programming Language :: Python
Programming Language :: Python :: 3
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
Topic :: Software Development :: Testing
Topic :: Software Development :: Quality Assurance
project_urls =
Documentation = https://stestr.readthedocs.io
Source Code = https://github.com/mtreinish/stestr
Bug Tracker = https://github.com/mtreinish/stestr/issues
python_requires = >=3.6
python_requires = >=3.8

[files]
packages =
Expand Down
33 changes: 9 additions & 24 deletions stestr/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

"""Run a projects tests and load them into stestr."""

import configparser
import errno
import functools
import io
Expand Down Expand Up @@ -480,29 +479,15 @@ def run_command(
repo = util.get_repo_open(repo_url=repo_url)
# If a repo is not found, and there a stestr config exists just create it
except repository.RepositoryNotFound:
if not os.path.isfile(config) and not test_path:
# If there is no config and no test-path
if os.path.isfile("tox.ini"):
tox_conf = configparser.SafeConfigParser()
tox_conf.read("tox.ini")
if not tox_conf.has_section("stestr"):
msg = (
"No file found, --test-path not specified, and "
"stestr section not found in tox.ini. Either "
"create or specify a .stestr.conf, use "
"--test-path, or add an stestr section to the "
"tox.ini"
)
stdout.write(msg)
exit(1)
else:
msg = (
"No config file found and --test-path not specified. "
"Either create or specify a .stestr.conf or use "
"--test-path "
)
stdout.write(msg)
exit(1)
conf = config_file.TestrConf.load_from_file(config)
if not conf.test_path and not test_path:
msg = (
"No config file found and --test-path not specified. "
"Either create or specify a .stestr.conf, tox.ini, "
"or pyproject.toml, or use --test-path"
)
stdout.write(msg)
exit(1)
try:
repo = util.get_repo_initialise(repo_url=repo_url)
except OSError as e:
Expand Down
3 changes: 3 additions & 0 deletions stestr/tests/files/conf.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.stestr]
test_path = './tests'
group_regex = '([^\.]*\.)*'
16 changes: 16 additions & 0 deletions stestr/tests/test_return_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,3 +507,19 @@ def setUp(self):
tox_file = os.path.join(self.repo_root, "stestr/tests/files/tox.ini")
shutil.copy(tox_file, self.tox_ini_dir)
os.remove(self.testr_conf_file)


class TestReturnCodesTOML(TestReturnCodes):
def setUp(self):
super().setUp()
self.pyproject_toml = os.path.join(self.directory, "pyproject.toml")
toml_conf = os.path.join(self.repo_root, "stestr/tests/files/conf.toml")
shutil.copy(toml_conf, self.pyproject_toml)
os.remove(self.testr_conf_file)

def test_all_configs_missing(self):
stestr_repo_dir = os.path.join(self.directory, ".stestr")
shutil.rmtree(stestr_repo_dir, ignore_errors=True)
os.remove(self.pyproject_toml)
output, _ = self.assertRunExit("stestr run passing", 1)
self.assertIn(b"No config file found", output)
2 changes: 1 addition & 1 deletion stestr/tests/test_subunit_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from ddt import data
from ddt import ddt
from ddt import unpack
from subunit.iso8601 import UTC
from iso8601 import UTC
from subunit.v2 import StreamResultToBytes

from stestr import subunit_trace
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ hacking<3.2.0,>=3.1.0
sphinx>2.1.0 # BSD
coverage>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT
iso8601 # MIT
doc8>=0.8.0 # Apache-2.0
black~=22.0
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 1.6
envlist = py311,py310,py39,py38,py37,pep8
envlist = py312,py311,py310,py39,py38,pep8
skipsdist = True

[testenv]
Expand Down Expand Up @@ -55,7 +55,7 @@ extras =
sql
commands =
doc8 -e .rst doc/source CONTRIBUTING.rst README.rst
python setup.py build_sphinx
sphinx-build -W -T --keep-going -b html doc/source doc/build/html

[testenv:releasenotes]
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
Expand Down

0 comments on commit f7900e7

Please sign in to comment.