I'd expect tests to pass cleanly on the master branch. Did I do something wrong?
sholden@overhead /tmp % git clone [email protected]:koxudaxi/fastapi-code-generator.git
Cloning into 'fastapi-code-generator'...
remote: Enumerating objects: 2344, done.
remote: Counting objects: 100% (732/732), done.
remote: Compressing objects: 100% (244/244), done.
remote: Total 2344 (delta 525), reused 640 (delta 469), pack-reused 1612
Receiving objects: 100% (2344/2344), 2.72 MiB | 2.07 MiB/s, done.
Resolving deltas: 100% (1248/1248), done.
sholden@overhead /tmp % cd fastapi-code-generator
sholden@overhead fastapi-code-generator % poetry install
Creating virtualenv fastapi-code-generator-4IuS1XPG-py3.10 in /Users/sholden/Library/Caches/pypoetry/virtualenvs
Installing dependencies from lock file
Package operations: 61 installs, 0 updates, 0 removals
β’ Installing six (1.16.0)
β’ Installing attrs (21.4.0)
β’ Installing idna (3.3)
β’ Installing pyrsistent (0.16.1)
β’ Installing sniffio (1.2.0)
β’ Installing anyio (3.5.0)
β’ Installing certifi (2021.10.8)
β’ Installing charset-normalizer (2.0.11)
β’ Installing dnspython (2.2.0)
β’ Installing h11 (0.12.0)
β’ Installing isodate (0.6.1)
β’ Installing jsonschema (3.2.0)
β’ Installing pyparsing (3.0.7)
β’ Installing ruamel.yaml.clib (0.2.6)
β’ Installing urllib3 (1.26.8)
β’ Installing appdirs (1.4.4)
β’ Installing chardet (4.0.0)
β’ Installing click (8.0.3)
β’ Installing email-validator (1.1.3)
β’ Installing httpcore (0.14.7)
β’ Installing iniconfig (1.1.1)
β’ Installing markupsafe (2.0.1)
β’ Installing openapi-schema-validator (0.1.6)
β’ Installing packaging (21.3)
β’ Installing pathspec (0.9.0)
β’ Installing pluggy (1.0.0)
β’ Installing py (1.11.0)
β’ Installing pyyaml (6.0)
β’ Installing regex (2022.1.18)
β’ Installing requests (2.27.1)
β’ Installing rfc3986 (1.5.0)
β’ Installing ruamel.yaml (0.17.20)
β’ Installing semver (2.13.0)
β’ Installing toml (0.10.2)
β’ Installing tomli (2.0.1)
β’ Installing typed-ast (1.5.2)
β’ Installing typing-extensions (4.0.1)
β’ Installing argcomplete (2.0.0)
β’ Installing black (19.10b0)
β’ Installing colorama (0.4.4)
β’ Installing coverage (6.3.1)
β’ Installing genson (1.2.2)
β’ Installing httpx (0.22.0)
β’ Installing inflect (5.4.0)
β’ Installing isort (4.3.21)
β’ Installing jinja2 (3.0.3)
β’ Installing mypy-extensions (0.4.3)
β’ Installing openapi-spec-validator (0.3.3)
β’ Installing prance (0.21.8.0)
β’ Installing pydantic (1.9.0)
β’ Installing pysnooper (0.5.0)
β’ Installing pytest (6.2.5)
β’ Installing python-dateutil (2.8.2)
β’ Installing shellingham (1.4.0)
β’ Installing datamodel-code-generator (0.11.19)
β’ Installing freezegun (1.1.0)
β’ Installing mypy (0.931)
β’ Installing pytest-cov (3.0.0)
β’ Installing pytest-mock (3.7.0)
β’ Installing stringcase (1.2.0)
β’ Installing typer (0.4.0)
Installing the current project: fastapi-code-generator (0.0.1)
sholden@overhead fastapi-code-generator % pytest
zsh: command not found: pytest
sholden@overhead fastapi-code-generator % ls
LICENSE docs/ mkdocs.yml poetry.lock scripts/
README.md fastapi_code_generator/ mypy.ini pyproject.toml tests/
sholden@overhead fastapi-code-generator % poetry run pytest
================================================================ test session starts ================================================================
platform darwin -- Python 3.10.4, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /private/tmp/fastapi-code-generator
plugins: anyio-3.5.0, mock-3.7.0, cov-3.0.0
collected 7 items
tests/test_generate.py ......F [100%]
===================================================================== FAILURES ======================================================================
_____________________________________________________________ test_generate_remote_ref ______________________________________________________________
__wrapped_mock_method__ = <function NonCallableMock.assert_has_calls at 0x103886200>
args = (<MagicMock name='get' id='4386748592'>, [call('https://schema.example', headers=None)]), kwargs = {}, __tracebackhide__ = True
msg = "Calls not found.\nExpected: [call('https://schema.example', headers=None)]\nActual: [call('https://schema.example', h...erify': True} == {}\n Left contains 2 more items:\n {'headers': None, 'verify': True}\n Use -v to get the full diff"
__mock_self = <MagicMock name='get' id='4386748592'>, actual_args = ('https://schema.example',), actual_kwargs = {'headers': None, 'verify': True}
introspection = "\nArgs:\nassert ('https://schema.example',) == ([call('https...aders=None)],)\n At index 0 diff: 'https://schema.exa...erify': True} == {}\n Left contains 2 more items:\n {'headers': None, 'verify': True}\n Use -v to get the full diff"
@py_assert2 = ([call('https://schema.example', headers=None)],), @py_assert1 = False
@py_format4 = "('https://schema.example',) == ([call('https...aders=None)],)\n~At index 0 diff: 'https://schema.example' != [call('https://schema.example', headers=None)]\n~Use -v to get the full diff"
def assert_wrapper(
__wrapped_mock_method__: Callable[..., Any], *args: Any, **kwargs: Any
) -> None:
__tracebackhide__ = True
try:
> __wrapped_mock_method__(*args, **kwargs)
/Users/sholden/Library/Caches/pypoetry/virtualenvs/fastapi-code-generator-4IuS1XPG-py3.10/lib/python3.10/site-packages/pytest_mock/plugin.py:414:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MagicMock name='get' id='4386748592'>, calls = [call('https://schema.example', headers=None)], any_order = False
def assert_has_calls(self, calls, any_order=False):
"""assert the mock has been called with the specified calls.
The `mock_calls` list is checked for the calls.
If `any_order` is False (the default) then the calls must be
sequential. There can be extra calls before or after the
specified calls.
If `any_order` is True then the calls can be in any order, but
they must all appear in `mock_calls`."""
expected = [self._call_matcher(c) for c in calls]
cause = next((e for e in expected if isinstance(e, Exception)), None)
all_calls = _CallList(self._call_matcher(c) for c in self.mock_calls)
if not any_order:
if expected not in all_calls:
if cause is None:
problem = 'Calls not found.'
else:
problem = ('Error processing expected calls.\n'
'Errors: {}').format(
[e if isinstance(e, Exception) else None
for e in expected])
> raise AssertionError(
f'{problem}\n'
f'Expected: {_CallList(calls)}'
f'{self._calls_repr(prefix="Actual").rstrip(".")}'
) from cause
E AssertionError: Calls not found.
E Expected: [call('https://schema.example', headers=None)]
E Actual: [call('https://schema.example', headers=None, verify=True)]
/opt/homebrew/Cellar/[email protected]/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10/unittest/mock.py:956: AssertionError
During handling of the above exception, another exception occurred:
mocker = <pytest_mock.plugin.MockerFixture object at 0x1059302b0>
@freeze_time("2020-06-19")
def test_generate_remote_ref(mocker):
oas_file = DATA_DIR / OPEN_API_REMOTE_REF_DIR_NAME / 'body_and_parameters.yaml'
person_response = mocker.Mock()
person_response.text = oas_file.read_text()
httpx_get_mock = mocker.patch('httpx.get', side_effect=[person_response])
with TemporaryDirectory() as tmp_dir:
output_dir = Path(tmp_dir) / oas_file.stem
generate_code(
input_name=oas_file.name,
input_text=oas_file.read_text(),
output_dir=output_dir,
template_dir=None,
)
> httpx_get_mock.assert_has_calls(
[call('https://schema.example', headers=None),]
)
E AssertionError: Calls not found.
E Expected: [call('https://schema.example', headers=None)]
E Actual: [call('https://schema.example', headers=None, verify=True)]
E
E pytest introspection follows:
E
E Args:
E assert ('https://schema.example',) == ([call('https...aders=None)],)
E At index 0 diff: 'https://schema.example' != [call('https://schema.example', headers=None)]
E Use -v to get the full diff
E Kwargs:
E assert {'headers': N...verify': True} == {}
E Left contains 2 more items:
E {'headers': None, 'verify': True}
E Use -v to get the full diff
tests/test_generate.py:78: AssertionError
================================================================= warnings summary ==================================================================
tests/test_generate.py::test_generate_default_template[oas_file0]
tests/test_generate.py::test_generate_default_template[oas_file1]
tests/test_generate.py::test_generate_default_template[oas_file2]
tests/test_generate.py::test_generate_default_template[oas_file3]
tests/test_generate.py::test_generate_default_template[oas_file4]
tests/test_generate.py::test_generate_custom_security_template[oas_file0]
tests/test_generate.py::test_generate_remote_ref
/Users/sholden/Library/Caches/pypoetry/virtualenvs/fastapi-code-generator-4IuS1XPG-py3.10/lib/python3.10/site-packages/datamodel_code_generator/format.py:87: UserWarning: black doesn't support `experimental-string-processing` option for wrapping string literal in 19.10b0
warn(
-- Docs: https://docs.pytest.org/en/stable/warnings.html
============================================================== short test summary info ==============================================================
FAILED tests/test_generate.py::test_generate_remote_ref - AssertionError: Calls not found.
====================================================== 1 failed, 6 passed, 7 warnings in 4.09s ======================================================