Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail: ValueError: option names {'--hypothesis-profile'} already added #4535

Closed
5 of 15 tasks
yurivict opened this issue Sep 19, 2022 · 6 comments
Closed
5 of 15 tasks
Assignees
Labels
bug V1 Bug related to Pydantic V1.X unconfirmed Bug not yet confirmed as valid/applicable

Comments

@yurivict
Copy link

yurivict commented Sep 19, 2022

Initial Checks

  • I have searched GitHub for a duplicate issue and I'm sure this is something new
  • I have searched Google & StackOverflow for a solution and couldn't find anything
  • I have read and followed the docs and still think this is a bug
  • I am confident that the issue is with pydantic (not my code, or another library in the ecosystem like FastAPI or mypy)

Description

===>   py39-pydantic-1.10.2 depends on file: /usr/local/bin/python3.9 - found
cd /disk-samsung/freebsd-ports/devel/py-pydantic/work-py39/pydantic-1.10.2 && /usr/bin/env XDG_DATA_HOME=/disk-samsung/freebsd-ports/devel/py-pydantic/work-py39  XDG_CONFIG_HOME=/disk-samsung/freebsd-ports/devel/py-pydantic/work-py39  XDG_CACHE_HOME=/disk-samsung/freebsd-ports/devel/py-pydantic/work-py39/.cache  HOME=/disk-samsung/freebsd-ports/devel/py-pydantic/work-py39 PATH=/usr/local/libexec/ccache:/disk-samsung/freebsd-ports/devel/py-pydantic/work-py39/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin PKG_CONFIG_LIBDIR=/disk-samsung/freebsd-ports/devel/py-pydantic/work-py39/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES LDSHARED="cc -shared" PYTHONDONTWRITEBYTECODE= PYTHONOPTIMIZE= PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe -fno-omit-frame-pointer  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS="-fno-omit-frame-pointer"  LDFLAGS=" -fstack-protector-strong " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer  "  MANPREFIX="/usr/local" CCACHE_DIR="/tmp/.ccache" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" /usr/local/bin/python3.9 -m pytest -k '' -rs -v -o addopts= 
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 187, in console_main
    code = main()
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 145, in main
    config = _prepareconfig(args, plugins)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 324, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/usr/local/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/usr/local/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/usr/local/lib/python3.9/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/usr/local/lib/python3.9/site-packages/_pytest/helpconfig.py", line 102, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/usr/local/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/local/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1017, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1305, in parse
    self._preparse(args, addopts=addopts)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1207, in _preparse
    self.hook.pytest_load_initial_conftests(
  File "/usr/local/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/usr/local/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/usr/local/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/usr/local/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/local/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1084, in pytest_load_initial_conftests
    self.pluginmanager._set_initial_conftests(
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 532, in _set_initial_conftests
    self._try_load_conftest(current, namespace.importmode, rootpath)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 551, in _try_load_conftest
    self._getconftestmodules(x, importmode, rootpath)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 575, in _getconftestmodules
    mod = self._importconftest(conftestpath, importmode, rootpath)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 623, in _importconftest
    self.consider_conftest(mod)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 704, in consider_conftest
    self.register(conftestmodule, name=conftestmodule.__file__)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 470, in register
    self.consider_module(plugin)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 712, in consider_module
    self._import_plugin_specs(getattr(mod, "pytest_plugins", []))
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 719, in _import_plugin_specs
    self.import_plugin(import_spec)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 756, in import_plugin
    self.register(mod, modname)
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/__init__.py", line 463, in register
    ret: Optional[str] = super().register(plugin, name)
  File "/usr/local/lib/python3.9/site-packages/pluggy/_manager.py", line 115, in register
    hook._maybe_apply_history(hookimpl)
  File "/usr/local/lib/python3.9/site-packages/pluggy/_hooks.py", line 300, in _maybe_apply_history
    res = self._hookexec(self.name, [method], kwargs, False)
  File "/usr/local/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/usr/local/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/usr/local/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/local/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python3.9/site-packages/_hypothesis_pytestplugin.py", line 98, in pytest_addoption
    group.addoption(
  File "/usr/local/lib/python3.9/site-packages/_pytest/config/argparsing.py", line 369, in addoption
    raise ValueError("option names %s already added" % conflict)
ValueError: option names {'--hypothesis-profile'} already added
*** Error code 1

Example Code

n/a

Python, Pydantic & OS Version

Python-3.9
Pydantic-1.10.2
FreeBSD 13.1

Affected Components

@yurivict yurivict added bug V1 Bug related to Pydantic V1.X unconfirmed Bug not yet confirmed as valid/applicable labels Sep 19, 2022
@samuelcolvin
Copy link
Member

Looks like a problem with how you're using either hypothesis or pytest, not pydantic.

Might be worth asking on the hypothesis repo.

@samuelcolvin samuelcolvin closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2022
@yurivict
Copy link
Author

I am not using hypothesis. I only run pytest on this repository.

@samuelcolvin
Copy link
Member

Is hypothesis installed?

Something is adding the --hypothesis-profile command line option, twice.

@yurivict
Copy link
Author

hypothesis is installed.
PyTest is used the same way as in many other Python projects.
The problem is still present in 1.10.4

@samuelcolvin
Copy link
Member

Weird. My guess is that hypothesis is somehow installed twice or being initiated twice.

Maybe worth asking on the hypothesis issue tracker, or maybe @Zac-HD would be kind enough to reply here?

@lig
Copy link
Contributor

lig commented Sep 18, 2023

closing this as there were no reproducible example provided here or on hypothesis issue

@lig lig closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X unconfirmed Bug not yet confirmed as valid/applicable
Projects
None yet
Development

No branches or pull requests

4 participants