Skip to content

Pytest crash with exit code 6 #9306

@jefer94

Description

@jefer94

With this script I see the exit code is 6

    exit_code = os.system(f'pytest {args} --disable-pytest-warnings')
    print(exit_code) # 6

This script prepare the environment and was used to run the tests pipenv run test

#!/bin/env python

from __future__ import absolute_import
import os
import sys
from .utils.environment import test_environment, reset_environment

if __name__ == '__main__':
    args = ''

    if len(sys.argv) > 1:
        sys.argv.pop(0)
        args = ' '.join(sys.argv)

    reset_environment()
    test_environment()
    exit_code = os.system(f'pytest {args} --disable-pytest-warnings')

    # python don't return 256
    if exit_code:
        sys.exit(1)

Output (i'm using Pytest 6.2.5 and Windows 11 with WSL 2 running Archlinux)

((apiv2) ) root@LACEY-MOSLEY ~/d/w/apiv2 (feature/fix-pdf-upload)# pipenv run test
Loading .env environment variables...
============================================= test session starts ==============================================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
django: settings: breathecode.test_settings (from ini)
rootdir: /root/development/work/apiv2, configfile: pytest.ini
plugins: Faker-9.8.1, xdist-2.4.0, forked-1.3.0, cov-3.0.0, django-4.4.0
collected 1182 items                                                                                           

breathecode/activity/tests/urls/tests_academy_cohort_id.py ............                                  [  1%]
...
breathecode/certificate/tests/actions/tests_certificate_screenshot.py .                                  [ 54%]
breathecode/certificate/tests/actions/tests_generate_certificate.py ⏎
((apiv2) ) root@LACEY-MOSLEY ~/d/w/apiv2 (feature/fix-pdf-upload) [1]# 

I don't understand why the test runner scrash without show a error, or why the exit code is 6

pip list

((apiv2) ) root@LACEY-MOSLEY ~/d/w/apiv2 (feature/fix-pdf-upload) [1]# pip list
Package                           Version
--------------------------------- ---------------
activecampaign-python             1.0.3
amqp                              5.0.6
asgiref                           3.4.1
atomicwrites                      1.4.0
attrs                             21.2.0
backports.entry-points-selectable 1.1.0
beautifulsoup4                    4.10.0
billiard                          3.6.4.0
cachetools                        4.2.4
celery                            5.2.0
certifi                           2021.10.8
cffi                              1.15.0
cfgv                              3.3.1
charset-normalizer                2.0.7
click                             8.0.3
click-didyoumean                  0.3.0
click-plugins                     1.1.1
click-repl                        0.2.0
contextlib2                       21.6.0
coverage                          6.1.1
coveralls                         3.3.0
Deprecated                        1.2.13
distlib                           0.3.3
dj-database-url                   0.5.0
Django                            3.2.9
django-cors-headers               3.10.0
django-heroku                     0.0.0
django-phonenumber-field          6.0.0
django-redis                      5.0.0
django-sql-explorer               2.3
djangorestframework               3.11.2
djangorestframework-csv           2.1.1
docopt                            0.6.2
eventbrite                        3.3.5
execnet                           1.9.0
Faker                             9.8.1
filelock                          3.3.2
ghp-import                        2.0.2
google-api-core                   1.31.4
google-auth                       1.35.0
google-cloud-core                 1.7.2
google-cloud-datastore            1.15.3
google-cloud-ndb                  1.11.1
google-cloud-storage              1.42.3
google-crc32c                     1.3.0
google-resumable-media            2.1.0
googleapis-common-protos          1.53.0
grpcio                            1.41.1
gunicorn                          20.1.0
hiredis                           2.0.0
icalendar                         4.0.9
identify                          2.3.4
idna                              3.3
importlib-metadata                4.8.1
iniconfig                         1.1.1
Jinja2                            3.0.2
kombu                             5.2.1
lxml                              4.6.4
Markdown                          3.3.4
MarkupSafe                        2.0.1
mergedeep                         1.3.4
mixer                             7.2.0
mkdocs                            1.2.3
mkdocs-autorefs                   0.3.0
mkdocs-material                   7.3.6
mkdocs-material-extensions        1.0.3
mkdocstrings                      0.16.2
nodeenv                           1.6.0
packaging                         21.2
phonenumberslite                  8.12.37
Pillow                            8.4.0
pip                               21.3.1
pipenv                            2021.11.5.post0
platformdirs                      2.4.0
pluggy                            1.0.0
pre-commit                        2.15.0
prompt-toolkit                    3.0.22
protobuf                          3.19.1
psycopg2-binary                   2.9.2
py                                1.11.0
pyasn1                            0.4.8
pyasn1-modules                    0.2.8
pycparser                         2.21
pyfcm                             1.5.4
PyGithub                          1.55
Pygments                          2.10.0
PyJWT                             2.3.0
pymdown-extensions                9.0
pymemcache                        3.5.0
PyNaCl                            1.4.0
pyparsing                         2.4.7
pytest                            6.2.5
pytest-cov                        3.0.0
pytest-django                     4.4.0
pytest-forked                     1.3.0
pytest-xdist                      2.4.0
python-dateutil                   2.8.2
python-slugify                    5.0.2
pytkdocs                          0.12.0
pytz                              2021.3
PyYAML                            6.0
pyyaml_env_tag                    0.1
redis                             3.5.3
requests                          2.26.0
rollbar                           0.16.2
rsa                               4.7.2
schema                            0.7.4
serpy                             0.3.1
setuptools                        58.5.3
six                               1.16.0
soupsieve                         2.3
sqlparse                          0.4.2
text-unidecode                    1.3
toml                              0.10.2
tomli                             1.2.2
twilio                            7.3.0
unicodecsv                        0.14.1
uritemplate                       4.1.1
urllib3                           1.26.7
vine                              5.0.0
virtualenv                        20.10.0
virtualenv-clone                  0.5.7
watchdog                          2.1.6
wcwidth                           0.2.5
wheel                             0.37.0
whitenoise                        5.3.0
wrapt                             1.13.3
XlsxWriter                        3.0.2
yapf                              0.31.0
zipp                              3.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions