Skip to content

Commit

Permalink
[TestSlide] Fix CI on Github
Browse files Browse the repository at this point in the history
  • Loading branch information
deathowl committed Dec 13, 2024
1 parent 65ed031 commit 747ce97
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
# Ensure that all flavours are run to completion even if an other flavor failed
fail-fast: false

Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ flake8: venv
@printf "${TERM_BRIGHT}FLAKE8 ${ALL_SRCS}\n${TERM_NONE}"
${Q} ${CURDIR}/venv/bin/flake8 --select=F,C90 $(ALL_SRCS)

.PHONY: black
black: venv
@printf "${TERM_BRIGHT}BLACK ${ALL_SRCS}\n${TERM_NONE}"
${Q} ${CURDIR}/venv/bin/black --check --diff $(ALL_SRCS) || { echo "Formatting errors found, try running 'make format'."; exit 1; }
.PHONY: ruff
ruff: venv
@printf "${TERM_BRIGHT}RUFF check ${ALL_SRCS}\n${TERM_NONE}"
${Q} ${CURDIR}/venv/bin/ruff check --diff $(ALL_SRCS) || { echo "Formatting errors found, try running 'make format'."; exit 1; }

.PHONY: format_black
format_black: venv
.PHONY: format_ruff
format_ruff: venv
@printf "${TERM_BRIGHT}FORMAT BLACK ${ALL_SRCS}\n${TERM_NONE}"
${Q} ${CURDIR}/venv/bin/black $(ALL_SRCS)
${Q} ${CURDIR}/venv/bin/ruff format $(ALL_SRCS)

.PHONY: tests
tests: \
Expand All @@ -134,12 +134,12 @@ tests: \
pytest_tests \
mypy \
flake8 \
black \
ruff \
check-copyright

.PHONY: format
format: \
format_black
format_ruff
@true
##
## Coverage
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black
ruff
coverage
coveralls
flake8
Expand Down
2 changes: 1 addition & 1 deletion testslide/bdd/dsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def nest_context(self, name: str, *args: Any, **kwargs: Any) -> None:
raise TypeError('Shared context "{}" does not exist'.format(name))
self._create_context(
name,
self.current_context.all_shared_contexts[name],
self.current_context.all_shared_contexts[name], # type: ignore
*args,
**kwargs, # type: ignore
)
Expand Down
10 changes: 5 additions & 5 deletions testslide/bdd/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def addError( # type:ignore
# inconsistently.
def addFailure( # type:ignore
self,
test: "TestCase",
test: "TestCase", # type: ignore
err: Tuple[
Type[BaseException],
BaseException,
Expand All @@ -456,9 +456,9 @@ def addUnexpectedSuccess(self, test: "TestCase") -> None: # type: ignore
# pyre-ignore
def addSubTest(
self,
test: "TestCase",
subtest: "TestCase",
err: Tuple[
test: "TestCase", # type: ignore
subtest: "TestCase", # type: ignore
err: Tuple[ # type: ignore
Optional[Type[BaseException]],
Optional[BaseException],
Optional[types.TracebackType],
Expand Down Expand Up @@ -532,7 +532,7 @@ class Context:
def __init__(
self,
name: str,
parent_context: Optional["Context"] = None,
parent_context: Optional["Context"] = None, # type: ignore
shared: bool = False,
skip: bool = False,
focus: bool = False,
Expand Down
2 changes: 1 addition & 1 deletion testslide/cli.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pyre-unsafe
from testslide.executor.cli import *
from testslide.executor.import_profiler import ImportedModule, ImportProfiler
from testslide.executor.import_profiler import ImportedModule, ImportProfiler # noqa

# pyre-fixme[21]: Could not find name `AggregatedExceptions` in
# `testslide.executor.lib`.
Expand Down
8 changes: 4 additions & 4 deletions testslide/core/mock_callable.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _is_coroutine(obj: Any) -> bool:
return inspect.iscoroutine(obj) or isinstance(
obj,
# pyre-ignore
asyncio.coroutines.CoroWrapper,
asyncio.coroutines.CoroWrapper, # type: ignore
)
else:
return inspect.iscoroutine(obj)
Expand Down Expand Up @@ -1014,7 +1014,7 @@ def to_raise(
_RaiseRunner(
self._original_target,
self._method,
self._original_callable,
self._original_callable, # type: ignore
ex, # type: ignore
)
)
Expand All @@ -1023,7 +1023,7 @@ def to_raise(
_RaiseRunner(
self._original_target,
self._method,
self._original_callable,
self._original_callable, # type: ignore
ex(), # type: ignore
)
)
Expand Down Expand Up @@ -1246,7 +1246,7 @@ def with_implementation(self, func: Callable) -> "_MockAsyncCallableDSL":
_AsyncImplementationRunner(
self._original_target,
self._method,
self._original_callable,
self._original_callable, # type: ignore
func, # type: ignore
)
)
Expand Down
2 changes: 1 addition & 1 deletion testslide/core/mock_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def mock_constructor(

if target_class_id in _mocked_target_classes:
original_class, mocked_class = _mocked_target_classes[target_class_id]
if not getattr(target, class_name) is mocked_class:
if getattr(target, class_name) is not mocked_class:
raise AssertionError(
"The class {} at {} was changed after mock_constructor() mocked "
"it!".format(class_name, target)
Expand Down
2 changes: 1 addition & 1 deletion testslide/executor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def example_code(self: Any) -> None:
"{}.{}".format(
test_case.__module__,
# pyre-ignore
test_case.__name__,
test_case.__name__, # type: ignore
)
)(get_context_code(test_case))

Expand Down
2 changes: 1 addition & 1 deletion testslide/executor/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def finish(self, not_executed_examples: List[Example]) -> None:
print("")
self.print_failed_example(
number + 1,
result["example"],
result["example"], # type: ignore
result["exception"], # type: ignore
)
print("")
Expand Down
6 changes: 3 additions & 3 deletions testslide/lib.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# pyre-unsafe
from testslide.core.lib import (
_extract_NonCallableMock_template,
CoroutineValueError,
_extract_NonCallableMock_template, # noqa
CoroutineValueError, # noqa
TypeCheckError,
WrappedMock,
WrappedMock, # noqa
)

TypeCheckError = TypeCheckError

0 comments on commit 747ce97

Please sign in to comment.