Message ID | 20191018205338.14879-4-trini@konsulko.com |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
Series | Moving test/py to Python 3 | expand |
Hi Tom, On Fri, 18 Oct 2019 at 14:53, Tom Rini <trini@konsulko.com> wrote: > > From: Marek Vasut <marek.vasut@gmail.com> > > Fix the following spit from pytest: > > u-boot/test/py/conftest.py:438: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. > Please use node.get_closest_marker(name) or node.iter_markers(name). > Docs: https://docs.pytest.org/en/latest/mark.html#updating-code > for board in mark.args: > > In both cases, the later suggestion is applicable. > > Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> > Cc: Igor Opaniuk <igor.opaniuk@linaro.org> > Cc: Tom Rini <trini@konsulko.com> > Cc: Simon Glass <sjg@chromium.org> > [trini: Update for current file with a few more cases, un-pin pytest in CI] > Signed-off-by: Tom Rini <trini@konsulko.com> > --- > .gitlab-ci.yml | 2 +- > .travis.yml | 2 +- > test/py/conftest.py | 30 ++++++++++++------------------ > 3 files changed, 14 insertions(+), 20 deletions(-) This causes a breakage on my machine even with the rest of the patches applied. make qcheck ./test/run quick sandbox: +make O=/scratch/sglass/cosarm/src/third_party/u-boot/files/build-sandbox -s sandbox_defconfig +make O=/scratch/sglass/cosarm/src/third_party/u-boot/files/build-sandbox -s -j8 INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 101, in wrap_session INTERNALERROR> config._do_configure() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/config.py", line 921, in _do_configure INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self)) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/__init__.py", line 628, in call_historic INTERNALERROR> res = self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/__init__.py", line 222, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/__init__.py", line 216, in <lambda> INTERNALERROR> firstresult=hook.spec_opts.get('firstresult'), INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/callers.py", line 201, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/callers.py", line 77, in get_result INTERNALERROR> _reraise(*ex) # noqa INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/callers.py", line 180, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/scratch/sglass/cosarm/src/third_party/u-boot/files/test/py/conftest.py", line 169, in pytest_configure INTERNALERROR> ini_sio = io.StringIO(ini_str) INTERNALERROR> TypeError: initial_value must be unicode or None, not str sandbox_spl: +make O=/scratch/sglass/cosarm/src/third_party/u-boot/files/build-sandbox_spl -s sandbox_spl_defconfig +make O=/scratch/sglass/cosarm/src/third_party/u-boot/files/build-sandbox_spl -s -j8 INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 101, in wrap_session INTERNALERROR> config._do_configure() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/config.py", line 921, in _do_configure INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self)) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/__init__.py", line 628, in call_historic INTERNALERROR> res = self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/__init__.py", line 222, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/__init__.py", line 216, in <lambda> INTERNALERROR> firstresult=hook.spec_opts.get('firstresult'), INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/callers.py", line 201, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/callers.py", line 77, in get_result INTERNALERROR> _reraise(*ex) # noqa INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/callers.py", line 180, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/scratch/sglass/cosarm/src/third_party/u-boot/files/test/py/conftest.py", line 169, in pytest_configure INTERNALERROR> ini_sio = io.StringIO(ini_str) INTERNALERROR> TypeError: initial_value must be unicode or None, not str sandbox_flattree: +make O=/scratch/sglass/cosarm/src/third_party/u-boot/files/build-sandbox_flattree -s sandbox_flattree_defconfig +make O=/scratch/sglass/cosarm/src/third_party/u-boot/files/build-sandbox_flattree -s -j8 INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 101, in wrap_session INTERNALERROR> config._do_configure() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/_pytest/config.py", line 921, in _do_configure INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self)) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/__init__.py", line 628, in call_historic INTERNALERROR> res = self._hookexec(self, self._nonwrappers + self._wrappers, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/__init__.py", line 222, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/__init__.py", line 216, in <lambda> INTERNALERROR> firstresult=hook.spec_opts.get('firstresult'), INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/callers.py", line 201, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/callers.py", line 77, in get_result INTERNALERROR> _reraise(*ex) # noqa INTERNALERROR> File "/usr/lib/python2.7/dist-packages/pluggy/callers.py", line 180, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "/scratch/sglass/cosarm/src/third_party/u-boot/files/test/py/conftest.py", line 169, in pytest_configure INTERNALERROR> ini_sio = io.StringIO(ini_str) INTERNALERROR> TypeError: initial_value must be unicode or None, not str Regards, Simon
On Mon, Oct 21, 2019 at 09:25:56AM -0600, Simon Glass wrote: > Hi Tom, > > On Fri, 18 Oct 2019 at 14:53, Tom Rini <trini@konsulko.com> wrote: > > > > From: Marek Vasut <marek.vasut@gmail.com> > > > > Fix the following spit from pytest: > > > > u-boot/test/py/conftest.py:438: RemovedInPytest4Warning: MarkInfo objects are deprecated as they contain merged marks which are hard to deal with correctly. > > Please use node.get_closest_marker(name) or node.iter_markers(name). > > Docs: https://docs.pytest.org/en/latest/mark.html#updating-code > > for board in mark.args: > > > > In both cases, the later suggestion is applicable. > > > > Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> > > Cc: Igor Opaniuk <igor.opaniuk@linaro.org> > > Cc: Tom Rini <trini@konsulko.com> > > Cc: Simon Glass <sjg@chromium.org> > > [trini: Update for current file with a few more cases, un-pin pytest in CI] > > Signed-off-by: Tom Rini <trini@konsulko.com> > > --- > > .gitlab-ci.yml | 2 +- > > .travis.yml | 2 +- > > test/py/conftest.py | 30 ++++++++++++------------------ > > 3 files changed, 14 insertions(+), 20 deletions(-) > > This causes a breakage on my machine even with the rest of the patches applied. > > make qcheck > ./test/run quick > sandbox: +make O=/scratch/sglass/cosarm/src/third_party/u-boot/files/build-sandbox > -s sandbox_defconfig > +make O=/scratch/sglass/cosarm/src/third_party/u-boot/files/build-sandbox -s -j8 > INTERNALERROR> Traceback (most recent call last): > INTERNALERROR> File > "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 101, in > wrap_session As I've promised Heinrich as well, I will update the README.md file for the tests. That's invoking python2-pytest so it's not going to work. You need to either pip3 (or virtualenv -p /usr/bin/python3) install pytest to get the python3 version.
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ab294997e463..5a34321570ce 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,7 +20,7 @@ stages: - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname` - virtualenv /tmp/venv - . /tmp/venv/bin/activate - - pip install pytest==2.8.7 + - pip install pytest - pip install python-subunit - pip install coverage - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd diff --git a/.travis.yml b/.travis.yml index a3e7451bcb17..f61278f9656a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,7 @@ install: - cat ~/.buildman - virtualenv /tmp/venv - . /tmp/venv/bin/activate - - pip install pytest==2.8.7 + - pip install pytest - pip install python-subunit - pip install pyelftools - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd diff --git a/test/py/conftest.py b/test/py/conftest.py index 00d8ef8ba99c..30c898b40a0d 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -431,11 +431,9 @@ def setup_boardspec(item): Nothing. """ - mark = item.get_marker('boardspec') - if not mark: - return required_boards = [] - for board in mark.args: + for boards in item.iter_markers('boardspec'): + board = boards.args[0] if board.startswith('!'): if ubconfig.board_type == board[1:]: pytest.skip('board "%s" not supported' % ubconfig.board_type) @@ -459,16 +457,14 @@ def setup_buildconfigspec(item): Nothing. """ - mark = item.get_marker('buildconfigspec') - if mark: - for option in mark.args: - if not ubconfig.buildconfig.get('config_' + option.lower(), None): - pytest.skip('.config feature "%s" not enabled' % option.lower()) - notmark = item.get_marker('notbuildconfigspec') - if notmark: - for option in notmark.args: - if ubconfig.buildconfig.get('config_' + option.lower(), None): - pytest.skip('.config feature "%s" enabled' % option.lower()) + for options in item.iter_markers('buildconfigspec'): + option = options.args[0] + if not ubconfig.buildconfig.get('config_' + option.lower(), None): + pytest.skip('.config feature "%s" not enabled' % option.lower()) + for option in item.iter_markers('notbuildconfigspec'): + option = options.args[0] + if ubconfig.buildconfig.get('config_' + option.lower(), None): + pytest.skip('.config feature "%s" enabled' % option.lower()) def tool_is_in_path(tool): for path in os.environ["PATH"].split(os.pathsep): @@ -491,10 +487,8 @@ def setup_requiredtool(item): Nothing. """ - mark = item.get_marker('requiredtool') - if not mark: - return - for tool in mark.args: + for tools in item.iter_markers('requiredtool'): + tool = tools.args[0] if not tool_is_in_path(tool): pytest.skip('tool "%s" not in $PATH' % tool)