[pgadmin4][patch] Change testing framework to pytest and grappa

From: Joao De Almeida Pereira <jdealmeidapereira(at)pivotal(dot)io>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: [pgadmin4][patch] Change testing framework to pytest and grappa
Date: 2018-04-30 19:48:54
Message-ID: CAE+jja=5xTdWxZMt1M3xpdZPOCCyZswzk+Lvb9Jx95SEJW8EhA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Hackers,
Attached you can find a patch that converts 3 unit test files to pytest and
grappa. This patch is a first step on to this migration.
We started this work because in our regular development we do TDD and with
the current setup we cannot run a single test or even a group of tests, the
minimum about is always a packages that can contain 1 test or 10. This
makes the Red - Green - Refactor cycle(
http://blog.cleancoder.com/uncle-bob/2014/12/17/TheCyclesOfTDD.html) much
harder and longer then it should be.
Also running tests in parallel was not possible, even if they were against
different databases.

After some investigation we found a couple of options to replace the
current setup and pytest looked like a good fit the only issue was the it
did not had a assertions library. For that we found a library called grappa
that is actively maintained and have a nice syntax to it.

0001 Patch contains the configuration files for pytests and also the 3
files that we converted to start using pytest + grappa

What do we know
- This converting will need a change in the way we run the tests in CI
- not all tests were converted, this is just a wip to see what people
think about this new framework
- Support for running the same test suite against multiple databases in a
single task, can be done, but we would have to add more code and we believe
there is a better way to accomplish this

For the CI we envision something similar the picture below
[image: Screen Shot 2018-04-30 at 3.40.13 PM.png]
In the middle we run 2 separate tasks one that runs the karma tests+js
linter and another one that lints the python code.
If everything looks good, then we run the boxes the the left, each box
represent a combination of database + python version.

We believe that using concouse or even jenkins we can achieve this making
the tests run in parallel for all environments and databases. The newer
versions of Jenkins have a pipeline DSL language that would allow us to
create pipelines like this one we have in concourse.

Ask
- Take a look at the new assertions syntax
- Give us your thoughts about this new CI structure

Thanks
Anthony & Joao

Attachment Content-Type Size
0001-use-pytests.patch application/octet-stream 192.3 KB

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2018-05-01 09:25:52 Re: [pgadmin4][patch] Change testing framework to pytest and grappa
Previous Message Joao De Almeida Pereira 2018-04-30 17:57:56 Re: [pgadmin4][patch] Initial patch to decouple from ACI Tree