[PATCH 09 of 10 logilab-database] [tox] Use unittest discover

Philippe Pepiot philippe.pepiot at logilab.fr
Tue Jun 5 11:28:19 CEST 2018


On 05/06/2018, Philippe Pepiot wrote:
> On 04/06/2018, Denis Laxalde wrote:
> > Olivier Giorgis a écrit :
> > > On 04/06/2018 12:00, Denis Laxalde wrote:
> > >> # HG changeset patch
> > >> # User Denis Laxalde <denis.laxalde at logilab.fr>
> > >> # Date 1528104502 -7200
> > >> #      Mon Jun 04 11:28:22 2018 +0200
> > >> # Node ID 8de0ea17b6695dff9e5cb9d340a26ab208a33a3c
> > >> # Parent  2db9072b1c9a9c8df551a4f778942ff5ec003b44
> > >> # Available At https://hg.logilab.org/review/logilab/database
> > >> #              hg pull https://hg.logilab.org/review/logilab/database -r 8de0ea17b669
> > >> # EXP-Topic py3
> > >> [tox] Use unittest discover
> > >>
> > >> Could not get pytest working, so fall back to unittest discover, still
> > >> better than lgc's pytest.
> > >>
> > >> diff --git a/tox.ini b/tox.ini
> > >> --- a/tox.ini
> > >> +++ b/tox.ini
> > >> @@ -5,4 +5,4 @@ envlist=py27,py3
> > >>  deps =
> > >>    psycopg2
> > >>  commands=
> > >> -    logilab-pytest -t test {posargs}
> > >> +    {envpython} -m unittest discover -s test {posargs:-p unittest_*.py}
> > > 
> > > The test test_adv_func_helper in test/unittest_db.py (line 176)
> > > 
> > > doesn't pass anymore locally for py27 environment since this changeset.
> > > 
> > > Do you have the same problem?
> > 
> > I have this problem locally, but since it works in CI
> > https://jenkins.logilab.org/job/logilab-database/, I did not bother to
> > investigate. Too much legacy code for today :)
> 
> This is because of reloading of the sqlite module in patch 7 (the class
> is reloaded during the test session, so isinstance() fail).
> 
> With a 'if six.PY3' before reload_module() call, I get py27 and py3
> tests passing locally.
> 
> I don't like having modules reloaded during tests, maybe add a 'if
> six.PY3' or just drop test_only_one_lazy_module_initialization() ?

Applied all patches except patch 07, thanks!


More information about the cubicweb-devel mailing list