Skip to content

Commit

Permalink
Merge branch 'main' into py_typed_files_exist
Browse files Browse the repository at this point in the history
  • Loading branch information
JayBazuzi authored Nov 17, 2024
2 parents f301d59 + ae7b1ff commit 0a56d12
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: [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:
Expand Down
2 changes: 1 addition & 1 deletion docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ If you want to set the extension of the approval file, you can now do it through
```py
verify(content, options=Options().for_file.with_extension(".md"))
```
<sup><a href='/tests/test_options.py#L67-L69' title='Snippet source file'>snippet source</a> | <a href='#snippet-options_with_file_extension' title='Start of snippet'>anchor</a></sup>
<sup><a href='/tests/test_options.py#L83-L85' title='Snippet source file'>snippet source</a> | <a href='#snippet-options_with_file_extension' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
5 changes: 4 additions & 1 deletion requirements.test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
setuptools
numpy
pylint
pytest-asyncio==0.21.1 # 0.23 has a bug 2023/12/3

pytest
pytest-asyncio==0.21.1 # 0.23 has a bug 2023/12/3
pytest-xdist

# mariadb
10 changes: 6 additions & 4 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
python -m pip install --upgrade pip
pip install tox
pip install pytest
tox -e py && tox -e test__py_typed_files_exist
#! /usr/bin/env bash
set -euo pipefail

python3 -m pip --disable-pip-version-check install tox
tox -e py
tox -e test__py_typed_files_exist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0) approvaltests.approvals
1) approvaltests.combination_approvals
2) approvaltests.integrations.mrjob.mrjob_approvals
3) approvaltests.utilities.command_line_approvals
4) approvaltests.utilities.logger.simple_logger_approvals
5) approvaltests.utilities.logging.logging_approvals
3 changes: 2 additions & 1 deletion tests/find_stale_approved_files.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#! /usr/bin/env python3
import os
import argparse
import pathlib
Expand Down Expand Up @@ -29,7 +30,7 @@ def main() -> None:

if missing_files:
print("The following files are not in the approved log:")
for file in missing_files:
for file in sorted(missing_files):
print(file)
else:
print("All found approved files are present in the log.")
Expand Down
26 changes: 21 additions & 5 deletions tests/test_options.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import importlib
import inspect
import sys

from approvaltests import (
get_default_reporter,
approvals,
verify,
verify_all,
ReporterForTesting,
combination_approvals,
)
Expand All @@ -13,14 +16,27 @@
from approvaltests.reporters.report_with_beyond_compare import ReportWithPycharm
from approvaltests.utilities import command_line_approvals
from approvaltests.utilities.logger import simple_logger_approvals
from approvaltests.utilities.logging import logging_approvals


_approvals_modules = list(
sorted(
filter(
lambda name: name.startswith("approvaltests.")
and name.endswith("approvals"),
sys.modules.keys(),
)
)
)


def test_list_of_modules():
verify_all("", _approvals_modules)


def test_every_function_in_approvals_with_verify_has_an_options():
assert_verify_methods_have_options(approvals)
assert_verify_methods_have_options(combination_approvals)
assert_verify_methods_have_options(simple_logger_approvals)
assert_verify_methods_have_options(command_line_approvals)
assert_verify_methods_have_options(mrjob_approvals)
for module_name in _approvals_modules:
assert_verify_methods_have_options(importlib.import_module(module_name))


def assert_verify_methods_have_options(module):
Expand Down

0 comments on commit 0a56d12

Please sign in to comment.