public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] test: correct entry point to pytest
@ 2021-01-28 11:46 Heinrich Schuchardt
  2021-01-28 12:58 ` Tom Rini
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Heinrich Schuchardt @ 2021-01-28 11:46 UTC (permalink / raw)
  To: u-boot

With Pytest 6.0.2 'make tests' fails:

sandbox: Traceback (most recent call last):
  File "./test/py/test.py", line 20, in <module>
    sys.exit(load_entry_point('pytest', 'console_scripts', 'pytest')(args))
TypeError: console_main() takes 0 positional arguments but 1 was given

The definition of console_scripts has changed as follows:

Pytest 4.6.1:

[options.entry_points]
console_scripts =
????????pytest=pytest:main
????????py.test=pytest:main
????????
Pytest 6.0.2:
????????
[options.entry_points]
console_scripts =
    pytest=pytest:console_main
    py.test=pytest:console_main

The new function console_main() has a comment:
"This function is not meant for programmable use; use `main()`"

Hence let's call pytest.main() directly.
Move args processing into the __main__ paragraph.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 test/py/test.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/py/test.py b/test/py/test.py
index bee88d96bc..285fda5425 100755
--- a/test/py/test.py
+++ b/test/py/test.py
@@ -10,11 +10,11 @@
 import os
 import os.path
 import sys
+import pytest
 from pkg_resources import load_entry_point

-# argv; py.test test_directory_name user-supplied-arguments
-args = [os.path.dirname(__file__) + '/tests']
-args.extend(sys.argv)
-
 if __name__ == '__main__':
-    sys.exit(load_entry_point('pytest', 'console_scripts', 'pytest')(args))
+    # argv; py.test test_directory_name user-supplied-arguments
+    args = [os.path.dirname(__file__) + '/tests']
+    args.extend(sys.argv)
+    sys.exit(pytest.main(args))
--
2.29.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-01-30 19:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-28 11:46 [PATCH] test: correct entry point to pytest Heinrich Schuchardt
2021-01-28 12:58 ` Tom Rini
2021-01-28 13:28   ` Heinrich Schuchardt
2021-01-28 16:17     ` Tom Rini
2021-01-28 18:36       ` Heinrich Schuchardt
2021-01-28 23:56         ` Tom Rini
2021-01-29  9:59           ` Andy Shevchenko
2021-01-28 18:23 ` Andy Shevchenko
2021-01-28 19:36 ` Andy Shevchenko
2021-01-30 19:21 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox