diff mbox series

[U-Boot] use pytest-3 instead of py.test

Message ID f1106778-91a8-0172-4649-79c0d8736c94@gmx.de
State Rejected
Delegated to: Tom Rini
Headers show
Series [U-Boot] use pytest-3 instead of py.test | expand

Commit Message

Heinrich Schuchardt Oct. 20, 2019, 1:21 p.m. UTC
On 10/20/19 3:11 PM, Heinrich Schuchardt wrote:
> On 10/20/19 2:27 PM, Tom Rini wrote:
>> On Sun, Oct 20, 2019 at 08:30:44AM +0200, Heinrich Schuchardt wrote:
>>> Hello Tom,
>>>
>>> I tested with the updated origin/WIP/Update-test.py-tests:
>>>
>>> $ python3 ./test/py/test.py --bd=qemu-arm64 --build-dir=. -k=test_efi_
>>> INTERNALERROR> Traceback (most recent call last):
>>> INTERNALERROR>   File
>>> "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 180, in
>>> wrap_session
>>
>> Yes, as I was saying on IRC you need to remove the system python-pytest
>> and install python3-pytest or switch to a virtualenv setup with
>> python=python3 and pip install pytest there.  These, unfortunately, are
>> the ways the Python community wants to deal with packaging.
>>
>
> python-pytest and python3-pytest are installed in completely separate
> directories, see
>
> https://packages.debian.org/de/sid/all/python3-pytest/filelist
> https://packages.debian.org/de/sid/all/python-pytest/filelist
>
> python-pytest cannot be invoked by python3.
>
> So uninstalling python-pytest cannot help to solve the issues that your
> patches cause.
>
> You know that python on most distros will call python2. So if you want
> to call python3 do it explicitly.
>
> virtualenv would only needed if you had different releases of python3
> packages that do not fit together.
>
> Best regards
>
> Heinrich

This is what you are missing:

git diff
      sys.exit(1)

Best regards

Heinrich
>

Comments

Tom Rini Oct. 20, 2019, 1:22 p.m. UTC | #1
On Sun, Oct 20, 2019 at 03:21:03PM +0200, Heinrich Schuchardt wrote:
> On 10/20/19 3:11 PM, Heinrich Schuchardt wrote:
> > On 10/20/19 2:27 PM, Tom Rini wrote:
> > > On Sun, Oct 20, 2019 at 08:30:44AM +0200, Heinrich Schuchardt wrote:
> > > > Hello Tom,
> > > > 
> > > > I tested with the updated origin/WIP/Update-test.py-tests:
> > > > 
> > > > $ python3 ./test/py/test.py --bd=qemu-arm64 --build-dir=. -k=test_efi_
> > > > INTERNALERROR> Traceback (most recent call last):
> > > > INTERNALERROR>   File
> > > > "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 180, in
> > > > wrap_session
> > > 
> > > Yes, as I was saying on IRC you need to remove the system python-pytest
> > > and install python3-pytest or switch to a virtualenv setup with
> > > python=python3 and pip install pytest there.  These, unfortunately, are
> > > the ways the Python community wants to deal with packaging.
> > > 
> > 
> > python-pytest and python3-pytest are installed in completely separate
> > directories, see
> > 
> > https://packages.debian.org/de/sid/all/python3-pytest/filelist
> > https://packages.debian.org/de/sid/all/python-pytest/filelist
> > 
> > python-pytest cannot be invoked by python3.
> > 
> > So uninstalling python-pytest cannot help to solve the issues that your
> > patches cause.
> > 
> > You know that python on most distros will call python2. So if you want
> > to call python3 do it explicitly.
> > 
> > virtualenv would only needed if you had different releases of python3
> > packages that do not fit together.
> > 
> > Best regards
> > 
> > Heinrich
> 
> This is what you are missing:
> 
> git diff
> diff --git a/test/py/test.py b/test/py/test.py
> index 0ce1838833..10f436f99e 100755
> --- a/test/py/test.py
> +++ b/test/py/test.py
> @@ -14,12 +14,12 @@ import sys
>  # Get rid of argv[0]
>  sys.argv.pop(0)
> 
> -# argv; py.test test_directory_name user-supplied-arguments
> -args = ['py.test', os.path.dirname(__file__) + '/tests']
> +# argv; pytest-3 test_directory_name user-supplied-arguments
> +args = ['pytest-3', os.path.dirname(__file__) + '/tests']

Nope, that's a Debian-ism.  pip install pytest doesn't give you anything
other than "py.test".
Heinrich Schuchardt Oct. 20, 2019, 2:43 p.m. UTC | #2
On 10/20/19 3:22 PM, Tom Rini wrote:
> On Sun, Oct 20, 2019 at 03:21:03PM +0200, Heinrich Schuchardt wrote:
>> On 10/20/19 3:11 PM, Heinrich Schuchardt wrote:
>>> On 10/20/19 2:27 PM, Tom Rini wrote:
>>>> On Sun, Oct 20, 2019 at 08:30:44AM +0200, Heinrich Schuchardt wrote:
>>>>> Hello Tom,
>>>>>
>>>>> I tested with the updated origin/WIP/Update-test.py-tests:
>>>>>
>>>>> $ python3 ./test/py/test.py --bd=qemu-arm64 --build-dir=. -k=test_efi_
>>>>> INTERNALERROR> Traceback (most recent call last):
>>>>> INTERNALERROR>   File
>>>>> "/usr/lib/python2.7/dist-packages/_pytest/main.py", line 180, in
>>>>> wrap_session
>>>>
>>>> Yes, as I was saying on IRC you need to remove the system python-pytest
>>>> and install python3-pytest or switch to a virtualenv setup with
>>>> python=python3 and pip install pytest there.  These, unfortunately, are
>>>> the ways the Python community wants to deal with packaging.
>>>>
>>>
>>> python-pytest and python3-pytest are installed in completely separate
>>> directories, see
>>>
>>> https://packages.debian.org/de/sid/all/python3-pytest/filelist
>>> https://packages.debian.org/de/sid/all/python-pytest/filelist
>>>
>>> python-pytest cannot be invoked by python3.
>>>
>>> So uninstalling python-pytest cannot help to solve the issues that your
>>> patches cause.
>>>
>>> You know that python on most distros will call python2. So if you want
>>> to call python3 do it explicitly.
>>>
>>> virtualenv would only needed if you had different releases of python3
>>> packages that do not fit together.
>>>
>>> Best regards
>>>
>>> Heinrich
>>
>> This is what you are missing:
>>
>> git diff
>> diff --git a/test/py/test.py b/test/py/test.py
>> index 0ce1838833..10f436f99e 100755
>> --- a/test/py/test.py
>> +++ b/test/py/test.py
>> @@ -14,12 +14,12 @@ import sys
>>   # Get rid of argv[0]
>>   sys.argv.pop(0)
>>
>> -# argv; py.test test_directory_name user-supplied-arguments
>> -args = ['py.test', os.path.dirname(__file__) + '/tests']
>> +# argv; pytest-3 test_directory_name user-supplied-arguments
>> +args = ['pytest-3', os.path.dirname(__file__) + '/tests']
>
> Nope, that's a Debian-ism.  pip install pytest doesn't give you anything
> other than "py.test".
>

Confirmed. On Debian I can use

sudo update-alternatives --install \
/usr/bin/py.test pytest /usr/bin/pytest-3 50
sudo update-alternatives --install \
/usr/bin/py.test pytest /usr/bin/pytest 30

to set up the alternatives such that pytest-3 invoked.

With this setting everything works fine now for me.

Best regards

Heinrich
diff mbox series

Patch

diff --git a/test/py/test.py b/test/py/test.py
index 0ce1838833..10f436f99e 100755
--- a/test/py/test.py
+++ b/test/py/test.py
@@ -14,12 +14,12 @@  import sys
  # Get rid of argv[0]
  sys.argv.pop(0)

-# argv; py.test test_directory_name user-supplied-arguments
-args = ['py.test', os.path.dirname(__file__) + '/tests']
+# argv; pytest-3 test_directory_name user-supplied-arguments
+args = ['pytest-3', os.path.dirname(__file__) + '/tests']
  args.extend(sys.argv)

  try:
-    os.execvp('py.test', args)
+    os.execvp('pytest-3', args)
  except:
      # Log full details of any exception for detailed analysis
      import traceback
@@ -27,6 +27,6 @@  except:
      # Hint to the user that they likely simply haven't installed the
required
      # dependencies.
      print('''
-exec(py.test) failed; perhaps you are missing some dependencies?
+exec(pytest-3) failed; perhaps you are missing some dependencies?
  See test/py/README.md for the list.''', file=sys.stderr)