Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial testing framework #7

Merged

Conversation

stevebachmeier
Copy link
Contributor

Title: Set up testing framework

Description

Set up framework for unit/integration tests. Most tests are skipped as TODOs
for when the relevant functionality gets added.

Testing

pytests pass

Copy link
Collaborator

@rmudambi rmudambi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some comments that I think should be addressed, but not in this PR. Feel free to merge.

import pytest


def pytest_addoption(parser):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this function have to be called pytest_addoption for some reason? Without an underscore between add and option it looks like you've misspelled adoption

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunately pytest boilerplate stuff: https://docs.pytest.org/en/7.1.x/example/simple.html

parser.addoption("--runslow", action="store_true", default=False, help="run slow tests")


def pytest_configure(config):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is all this doing? Isn't there a native option to mark tests as slow that we've already been using?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I'm aware of.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does look like there's a package we can download if we'd like to instead: https://pypi.org/project/pytest-skip-slow/

I'm surprised this isn't just default pytest



@pytest.fixture()
def noise_requirements() -> Dict:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you envisioning this being used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it. It was lingering from a test I decided against after chatting w/ Matt

tests/unit/test_column_noise.py Show resolved Hide resolved
def test_default_configuration():
config = get_default_configuration()
assert config
assert isinstance(config, ConfigTree)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test that this configuration actually matches what we'd expect it to be. We can do this either by comparing it to the values in the yaml file, or by just confirming that the correct call to config_tree.update() was made in the function. The latter seems preferable to me as a unit test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's kinda what I was getting at earlier when I mentioned a test that loads the default and compares it to a "new" default. Not sure offhand how to test more directly. will add a dummy test

@stevebachmeier stevebachmeier merged commit 94aa95f into main Mar 16, 2023
@stevebachmeier stevebachmeier deleted the feature/sbachmei/MIC-3862-set-up-testing-framework branch March 16, 2023 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants