Commit 3c941e048c824b94ae09fd9e1f91116f55ce0f1f

Authored by Marek Vasut
Committed by Tom Rini
1 parent 79883ef7dc

test/py: Fix pytest4 deprecation warnings

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.

Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Igor Opaniuk <igor.opaniuk@gmail.com>
[trini: Update for current file with a few more cases, un-pin pytest in CI]
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Rini <trini@konsulko.com>

Showing 3 changed files with 14 additions and 20 deletions Side-by-side Diff

... ... @@ -20,7 +20,7 @@
20 20 - ln -s travis-ci /tmp/uboot-test-hooks/py/`hostname`
21 21 - virtualenv /tmp/venv
22 22 - . /tmp/venv/bin/activate
23   - - pip install pytest==2.8.7
  23 + - pip install pytest
24 24 - pip install python-subunit
25 25 - pip install coverage
26 26 - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
... ... @@ -49,7 +49,7 @@
49 49 - cat ~/.buildman
50 50 - virtualenv /tmp/venv
51 51 - . /tmp/venv/bin/activate
52   - - pip install pytest==2.8.7
  52 + - pip install pytest
53 53 - pip install python-subunit
54 54 - pip install pyelftools
55 55 - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd
... ... @@ -431,11 +431,9 @@
431 431 Nothing.
432 432 """
433 433  
434   - mark = item.get_marker('boardspec')
435   - if not mark:
436   - return
437 434 required_boards = []
438   - for board in mark.args:
  435 + for boards in item.iter_markers('boardspec'):
  436 + board = boards.args[0]
439 437 if board.startswith('!'):
440 438 if ubconfig.board_type == board[1:]:
441 439 pytest.skip('board "%s" not supported' % ubconfig.board_type)
... ... @@ -459,16 +457,14 @@
459 457 Nothing.
460 458 """
461 459  
462   - mark = item.get_marker('buildconfigspec')
463   - if mark:
464   - for option in mark.args:
465   - if not ubconfig.buildconfig.get('config_' + option.lower(), None):
466   - pytest.skip('.config feature "%s" not enabled' % option.lower())
467   - notmark = item.get_marker('notbuildconfigspec')
468   - if notmark:
469   - for option in notmark.args:
470   - if ubconfig.buildconfig.get('config_' + option.lower(), None):
471   - pytest.skip('.config feature "%s" enabled' % option.lower())
  460 + for options in item.iter_markers('buildconfigspec'):
  461 + option = options.args[0]
  462 + if not ubconfig.buildconfig.get('config_' + option.lower(), None):
  463 + pytest.skip('.config feature "%s" not enabled' % option.lower())
  464 + for option in item.iter_markers('notbuildconfigspec'):
  465 + option = options.args[0]
  466 + if ubconfig.buildconfig.get('config_' + option.lower(), None):
  467 + pytest.skip('.config feature "%s" enabled' % option.lower())
472 468  
473 469 def tool_is_in_path(tool):
474 470 for path in os.environ["PATH"].split(os.pathsep):
... ... @@ -491,10 +487,8 @@
491 487 Nothing.
492 488 """
493 489  
494   - mark = item.get_marker('requiredtool')
495   - if not mark:
496   - return
497   - for tool in mark.args:
  490 + for tools in item.iter_markers('requiredtool'):
  491 + tool = tools.args[0]
498 492 if not tool_is_in_path(tool):
499 493 pytest.skip('tool "%s" not in $PATH' % tool)
500 494