Projet

Général

Profil

Development #10473

ajout tox.ini qui va vite

Ajouté par Benjamin Dauvergne il y a environ 8 ans. Mis à jour il y a presque 8 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
Début:
29 mars 2016
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:

Fichiers

0001-add-a-fast-tox.ini.patch (1,25 ko) 0001-add-a-fast-tox.ini.patch Benjamin Dauvergne, 29 mars 2016 18:53
0001-add-a-fast-tox.ini.patch (1001 octets) 0001-add-a-fast-tox.ini.patch Benjamin Dauvergne, 29 mars 2016 19:18
0001-add-a-fast-tox.ini.patch (1,08 ko) 0001-add-a-fast-tox.ini.patch Benjamin Dauvergne, 30 mars 2016 02:48
0001-add-a-fast-tox.ini.patch (1,04 ko) 0001-add-a-fast-tox.ini.patch Benjamin Dauvergne, 30 mars 2016 10:17
0001-add-a-fast-tox.ini.patch (1,06 ko) 0001-add-a-fast-tox.ini.patch Benjamin Dauvergne, 30 mars 2016 10:18

Révisions associées

Révision f6254c65 (diff)
Ajouté par Benjamin Dauvergne il y a environ 8 ans

add a fast tox.ini (#10473)

Historique

#1

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

#2

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

Je me suis trompé sur l'utilisation de toxworkdir, il ne faut pas y mettre le nom de l'environnement.

#3

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

Avec les bonnes valeurs reportés depuis la config jenkins (--cov et --cov-config).

#4

Mis à jour par Frédéric Péters il y a environ 8 ans

toxworkdir = ~/.cache/tox/virtualenvs/wcs/ crée un répertoire "~" dans le répertoire courant…

Une fois cela corrigé, le premier run :

real    7m45.740s
user    2m35.440s
sys     0m12.676s

18 failed, 835 passed, 24 skipped.

Avec le tox.ini modifié pour mettre $TMP et le toxworkdir dans tmpfs, et en retirant le coverage :

real    3m11.449s
user    1m37.816s
sys     0m8.308s

17 failed, 836 passed, 24 skipped.

Ce qui correspond à mon exécution manuelle :

real    3m16.473s
user    1m43.176s
sys     0m6.900s

869 passed, 8 skipped.

Modulo des tests ignorés quand c'est exécuté dans tox (parce que pas de lasso) ainsi que des tests en erreurs, que je ne vais pas analyser maintenant (une curieuse tendance à inverser les éléments des listes, ce qui pourrait être contré en testant de manière plus systématique avec set() plutôt que comparer liste à liste).

De ton côté, les tests passent ?

#5

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

J'ai encore des petits soucis sur les tests qui dépendent de l'état du générateur aléatoire (ticket #10477) et aussi un sur les nouveaux tests test_inspect_page que je ne comprends pas, il ne dépend pas de la graine mais n'arrive que dans tox, la trace n'est même pas logique (PS: j'ai trouvé, htmltext a une version en C et une en python, la version en C est buggée, mais de la façon dont j'ai monté mon venv local, la librairie dynamique n'est pas trouvée, alors que dans tox quixote est correctement installé):

____________________________________________________________________________ test_inspect_page[sql] ____________________________________________________________________________

pub = <wcs.publisher.WcsPublisher instance at 0x7f19fd70e8c0>

    def test_inspect_page(pub):
        create_user(pub)
        create_environment(pub)

        formdef = FormDef.get_by_urlname('form-title')
        formdata = [x for x in formdef.data_class().select() if x.status == 'wf-new'][0]
        # temper with field 3 structured values

        formdata.data['3_structured'] = {
            'unicode': u'uné',
            'str_but_non_utf8': '\xed\xa0\x00',
            'non_unicode_convertible': IHateUnicode(),
        }
        formdata.store()

        resp = login(get_app(pub)).get('%sinspect' % formdata.get_url(backoffice=True), status=403)

        create_user(pub, is_admin=True)
>       resp = login(get_app(pub)).get('%sinspect' % formdata.get_url(backoffice=True), status=200)

tests/test_backoffice_pages.py:2156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
~/.cache/tox/wcs/coverage-pg/local/lib/python2.7/site-packages/webtest/app.py:323: in get
    expect_errors=expect_errors)
~/.cache/tox/wcs/coverage-pg/local/lib/python2.7/site-packages/webtest/app.py:632: in do_request
    self._check_status(status, res)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <webtest.app.TestApp object at 0x7f19fdea1d50>, status = 200, res = <500 Internal Server Error text/html body='<!DOCTYPE...l>\n'/671>

    def _check_status(self, status, res):
        if status == '*':
            return
        res_status = res.status
        if (isinstance(status, string_types) and '*' in status):
            if re.match(fnmatch.translate(status), res_status, re.I):
                return
        if isinstance(status, string_types):
            if status == res_status:
                return
        if isinstance(status, (list, tuple)):
            if res.status_int not in status:
                raise AppError(
                    "Bad response: %s (not one of %s for %s)\n%s",
                    res_status, ', '.join(map(str, status)),
                    res.request.url, res)
            return
        if status is None:
            if res.status_int >= 200 and res.status_int < 400:
                return
            raise AppError(
                "Bad response: %s (not 200 OK or 3xx redirect for %s)\n%s",
                res_status, res.request.url,
                res)
        if status != res.status_int:
            raise AppError(
>               "Bad response: %s (not %s)", res_status, status)
E           AppError: Bad response: 500 Internal Server Error (not 200)

~/.cache/tox/wcs/coverage-pg/local/lib/python2.7/site-packages/webtest/app.py:667: AppError
----------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------
[2016-03-30 02:08:28] exception caught
Exception:
  type = '<type 'exceptions.TypeError'>', value = 'unbound method __unicode__() must be called with IHateUnicode instance as first argument (got nothing instead)'

Stack trace (most recent call first):
  File "/home/bdauvergne/Code/wcs/wcs/backoffice/management.py", line 1836, in inspect
  1834             r += htmltext('  <div class="value"><span>%s</span>') % safe(v)
  1835             if not isinstance(v, basestring):
> 1836                 r += htmltext(' <span class="type">(%s)</span>') % type(v)
  1837             r += htmltext('</div>')
  1838         r += htmltext('</ul>')

  locals: 
     safe = <function safe at 0x7f19fdf82f50>
     charset = 'utf-8'
     substvars = {'form_evolution': '\n\n----\n\nStatus\n  New', 'form_submission_channel': None, 'form_status_changed': True, 'form_submission_channel_label': 'Web', 'form_status': 'New', 'form_f1': 'FOO BAR 0', 'form_f2': 'foo', 'form_f3': 'A', 'form_submission_backoffice': False, 'form_var_foo_unicode': u'un\xe9', 'form_receipt_time': '00:00', 'form_name': 'form title', 'form_criticality_level': 0, 'form_status_url': 'http://example.net/form-title/1/status', 'form_number': '1-1', 'form_details': '1st field:\n  FOO BAR 0\n\n2nd field:\n  foo\n\n3rd field:\n  aa\n', 'form_url_backoffice': 'http://example.net/backoffice/management/form-title/1/', 'form_var_foo_raw': 'A', 'form_status_is_endpoint': False, 'form_objects': <wcs.formdef.FormDefSubstVar object at 0x7f19fd8b30d0>, 'form_var_foo_non_unicode_convertible': ok, 'form_number_raw': '1', 'form_field_3rd_field': 'A', 'form_var_foo_str_but_non_utf8': '\xed\xa0\x00', 'form_previous_status': 'Just Submitted', 'form_role_receiver_name': 'foobar', 'form_comment': '', 'form_var_foo': 'aa', 'form_uri': 'form-title/1/', 'form_url': 'http://example.net/form-title/1/', 'form_field_2nd_field': 'foo', 'form_receipt_date': '2015-01-01', 'form_field_1st_field': 'FOO BAR 0'}
     k = 'form_var_foo_non_unicode_convertible'
     v = ok
     self = <wcs.backoffice.management.FormBackOfficeStatusPage object at 0x7f19fd8ffcd0>
     r = <TemplateIO object at 0x7f19fdeaa5d0>

#6

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

Pour le coverage j'ai vu qu'on pouvait mettre des directives spéciales jenkins dans [tox:jenkins], elles s'activent quand il détecte la variable d'environnement JENKINS_URL.

#7

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

Voilà par défaut je ne met pas les options coverage, je lance en mode pickle+pg (le jenkins.sh n'aurau qu'à lister explicitement qu'il le veut) et toxworkdir est défini à /tmp/tox-{env:USER}/wcs/.

#8

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

Perdu le PYTHONPATH au passage

#9

Mis à jour par Frédéric Péters il y a environ 8 ans

Mon tmpfs n'est pas monté sur /tmp/, mais ignorons ma situation, je continuerai en local à utiliser py.test directement.

#10

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

100 balles et un mars ? Et avec ça, ça irait ?

toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/wcs/
#11

Mis à jour par Frédéric Péters il y a environ 8 ans

Sérieusement, je n'ai aucun problème à avoir un tox.ini utilisé par jenkins et qui en veut, et je peux même essayer de l'utiliser, et c'est bien mieux qu'avant (merci), n'ajoutons rien de particulier à ma situation au tox.ini. (mais par ailleurs, oui, TMPDIR c'est mieux qu'hardcoder /tmp/)

#12

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

  • Statut changé de Nouveau à Résolu (à déployer)
commit f6254c65ee106e419e91708a76af2f1bcd385462
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Tue Mar 29 18:52:09 2016 +0200

    add a fast tox.ini (#10473)

#13

Mis à jour par Thomas Noël il y a environ 8 ans

  • Version cible mis à v1.39
#14

Mis à jour par Frédéric Péters il y a presque 8 ans

  • Statut changé de Résolu (à déployer) à Fermé

Formats disponibles : Atom PDF