guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#39777] [PATCH V3 04/11] gnu: python-jsonschema: Update to 3.2.0.


From: Tanguy Le Carrour
Subject: [bug#39777] [PATCH V3 04/11] gnu: python-jsonschema: Update to 3.2.0.
Date: Fri, 13 Mar 2020 09:45:41 +0100

Le 03/12, Leo Famulari a écrit :
> On Thu, Mar 12, 2020 at 09:48:28AM +0100, Tanguy Le Carrour wrote:
> > The test relies on a call to `subprocess.check_output` to run
> > `python -m jsonschema --version`, but it behaves like `--version` was
> > never passed to the command?!
> 
> How do you know it behaves like that? Is there some error output?

Actually, you're right, I don't know, because I didn't reproduce the exact same
error!

```
$ ./pre-inst-env guix build python-jsonschema -K
[…]
subprocess.CalledProcessError: Command 
'['/gnu/store/l8nphg0idd8pfddyad8f92lx8d1hc053-python-wrapper-3.7.4/bin/python',
 '-m', 'jsonschema', '--version']' returned non-zero exit status 1.
```

The exit status is 1.

To reproduce it in the build directory I did the following:

```
$ cd /tmp/guix-build-python-jsonschema-3.2.0.drv-0/jsonschema-3.2.0/
$ guix environment python-jsonschema --ad-hoc python-importlib-metadata
$ set -x PYTHONPATH .:$PYTHONPATH # I'm using Fish
$ trial jsonschema/tests/test_cli.py                                            
                                                                                
                                                                  [env] GUIX
jsonschema.tests.test_cli
  TestCLI
    test_draft3_schema_draft4_validator ...                                [OK]
    test_successful_validation ...                                         [OK]
    test_unsuccessful_validation ...                                       [OK]
    test_unsuccessful_validation_multiple_instances ...                    [OK]
    test_version ...                                                    [ERROR]

===============================================================================
[ERROR]
Traceback (most recent call last):
[…]
subprocess.CalledProcessError: Command 
'['/gnu/store/m4kgg8z52kn6xspmd3brvivd129d4i3s-python-wrapper-3.7.4/bin/python',
 '-m', 'jsonschema', '--version']' returned non-zero exit status 2.
```

But the exit status was… 2! Which I didn't pay attention at first.

Then, I modified the code of the test to add some log:

```
$ trial jsonschema/tests/test_cli.py                                            
                           [env] GUIX
jsonschema.tests.test_cli
  TestCLI
    test_draft3_schema_draft4_validator ...                                [OK]
    test_successful_validation ...                                         [OK]
    test_unsuccessful_validation ...                                       [OK]
    test_unsuccessful_validation_multiple_instances ...                    [OK]
    test_version ... usage: __main__.py [-h] [-i INSTANCES] [-F ERROR_FORMAT] 
[-V VALIDATOR] schema
__main__.py: error: the following arguments are required: schema
                                                   [ERROR]
```

This error message in the output is the one I would get by calling
`python -m jsonschema` without `--version`.

This was the end of my investigation and… a mistake! ^_^'

Right after your question, I tried to do the same but directly from my package
definition by adding a `substitute`:

```
(add-before 'check 'replace-check-output
  (lambda _
          (substitute* "jsonschema/tests/test_cli.py"
            (("check_output") "check_call"))
          #t))
```

Re-built the package and… got the exit status 1 with a different error message
in the log:

```
jsonschema.tests.test_cli
  TestCLI
    test_draft3_schema_draft4_validator ...                                [OK]
    test_successful_validation ...                                         [OK]
    test_unsuccessful_validation ...                                       [OK]
    test_unsuccessful_validation_multiple_instances ...                    [OK]
    test_version ... 
/gnu/store/l8nphg0idd8pfddyad8f92lx8d1hc053-python-wrapper-3.7.4/bin/python: No 
module named jsonschema
                                                   [ERROR]
===============================================================================
[ERROR]
Traceback (most recent call last):
[…]
subprocess.CalledProcessError: Command 
'['/gnu/store/l8nphg0idd8pfddyad8f92lx8d1hc053-python-wrapper-3.7.4/bin/python',
 '-m', 'jsonschema', '--version']' returned non-zero exit status 1.
```

So, I'm left with the same question:
 - why does it fail with `No module named jsonschema`? and with a second one
 - why wasn't I able to reproduce the error from the build directory?!

I still have a lot to learn! :-(
Any help welcome!

-- 
Tanguy





reply via email to

[Prev in Thread] Current Thread [Next in Thread]