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.

Add parametrized tests for saving/fetching metadata in all products

See original GitHub issue

The Product abstract class defines two abstract methods (fetch_metadata and save_metadata), and each concrete class (such as File) must implement them. Although the implementation is different for each concrete classes, the interface is the same so we need a parametrized test (using pytest.mark.parametrize) that checks that all concrete classes implement both methods correctly.

Concrete classes are defined here: https://github.com/ploomber/ploomber/blob/master/src/ploomber/products/file.py https://github.com/ploomber/ploomber/blob/master/src/ploomber/products/genericproduct.py https://github.com/ploomber/ploomber/blob/master/src/ploomber/products/sql.py

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
idomiccommented, Sep 2, 2022

Let’s pause this work now, we’ll assign a new issue to work on since this is a lower priority.

On Fri, Sep 2, 2022 at 10:10 AM Suren @.***> wrote:

Hey, I have some specific questions regarding my issue.

This is an example of a file test I’ve created: `def test_save_metadata(): Path(‘sample.txt’).touch() File(‘sample.txt’).save_metadata({“pageNumber”: “3”}) meta = File(‘sample.txt’).fetch_metadata()

assert meta[‘pageNumber’] == “3”`

For the GenericProduct class:

SQL

  • These methods are already tested. How can I get started parametrizing this?

— Reply to this email directly, view it on GitHub https://github.com/ploomber/ploomber/issues/57#issuecomment-1235553044, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACYPJOM2XWZFX5ONGRITDFTV4IDEJANCNFSM4LSECX5Q . You are receiving this because you commented.Message ID: @.***>

0reactions
surenzzcommented, Sep 2, 2022

Hey, I have some specific questions regarding my issue.

This is an example of a file test I’ve created:

def test_save_metadata():  
    Path('sample.txt').touch()  
    File('sample.txt').save_metadata({"pageNumber": "3"})  
    meta = File('sample.txt').fetch_metadata()  
    assert meta['pageNumber'] == "3"  

For the GenericProduct class:

SQL

  • These methods are already tested. How can I get started parametrizing this?
Read more comments on GitHub >

github_iconTop Results From Across the Web

Add parameterized data sets - ServiceNow Docs
Navigate to All > Automated Test Framework > Tests. · Open a parameterized test. · In the Test Run Data Sets related list,...
Read more >
Creating a Parameterized Unit Test - Parasoft Jtest 2021.1
Introduction. Unit Test Assistant can help you create parameterized test cases to test methods against different arguments.
Read more >
JUnit 5 Tutorial: Writing Parameterized Tests - Petri Kainulainen
This blog post describes how we can write parameterized tests with JUnit 5. After we have finished this blog post, we:.
Read more >
Parameterize load tests with secrets and environment variables
Learn how to create configurable load tests by using secrets and environment variables as parameters in Azure Load Testing.
Read more >
Writing Tests (go/tast-writing)
A local test named ui.DoSomething should be defined in a file named src/chromiumos/tast/local/bundles/cros/ui/do_something.go (i.e. ...
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