question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

test: use pytest fixtures to initialize and populate the backends

See original GitHub issue

I propose to port the click commands from datamgr.py and impalamgr to pytest fixtures (with scope="session" to execute once per pytest invocation).

The python testing suite is dependent on the files under the ci/ directory. Examples:

PYTEST_BACKEND=pandas pytest ibis/backends or pytest --enable-pandas ibis/backends should:

  1. Check that the testing data exists under the target directory
  2. If not, download it otherwise skip
  3. Execute the tests with pandas marker enabled

PYTEST_BACKEND=clickhouse pytest ibis/backends or pytest --enable-clickhouse ibis/backends should:

  1. Check that the testing data exists under the target directory
  2. If not, download it otherwise skip
  3. Check that the required tables exist in clickhouse
  4. If not, populate the tables otherwise skip
  5. Execute the tests with clickhouse marker enabled

We can add pytest flags to --force-download/ --skip-download and --force-populate/--skip-populate the requested backends.

Even though the first run would take more time since it would implicitly download the data (the second run would be instant), new contributors could use the a single pytest command to execute the testing suite. We can add additional logging / progress bar to inform the developer about the data[base] initialization.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
anjakefalacommented, May 11, 2022

/take

2reactions
cpcloudcommented, May 4, 2022

Heck yeah!

Welcome @anjakefala.

Right, download is very simple and does a git clone of ibis-project/ibis-testing-data. Feel free to take a look at it, but it’s pretty bare bones.

The bulk of the work is going to be in figuring out how to move all the functionality in the load subcommands like

python ci/datamgpr.py load postgres
python ci/datamgpr.py load duckdb

into a pytest.fixture (that was my initial thought, not set in stone in any way).

Read more comments on GitHub >

github_iconTop Results From Across the Web

pytest fixtures: explicit, modular, scalable
Software test fixtures initialize test functions. They provide a fixed baseline so that tests execute reliably and produce consistent, repeatable, results.
Read more >
How I Use Pytest Fixtures for System Testing - Atomic Spin
Here, I'll highlight how we apply some simple options for configuring fixture usage. This will allow you to do things like create API...
Read more >
How to Use Pytest Fixtures With Django Models - Velotio
Learn how to provide test fixtures for your Django models using Pytest and write easy-to-read tests for your app.
Read more >
Unit Testing with Pytest and Moto | by TensorIoT Editor - Medium
fixtures have explicit names and are activated by declaring their use from test functions, modules, classes or whole projects. ○ fixtures are ...
Read more >
Adding Function Arguments to pytest Fixtures - Siv Scripts
initializing test objects. In pytest, we use the @pytest.fixture decorator to create fixtures. pytest will then insert fixtures into our test ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found