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

Mark org speed test as 'performance', exclude performance tests from running without flag #4816

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kobo/apps/stripe/tests/test_organization_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_doesnt_include_org_users_with_invalid_plan(self):
self.expected_file_size() * self.expected_submissions_single
)

@pytest.mark.xfail
@pytest.mark.performance
Copy link
Member

Choose a reason for hiding this comment

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

Now that the test is excluded by default, would it be worth cranking up the number of model instances to a number that you would want to use when you run performance tests? (Or, if not, adding a comment describing how someone might use the test to test performance meaningfully?)

def test_endpoint_speed(self):
# get the average request time for 10 hits to the endpoint
single_user_time = timeit.timeit(lambda: self.client.get(self.detail_url), number=10)
Expand Down
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ extend-select = ["I"]
[tool.ruff.lint.isort]
known-first-party = ["kobo"]

[tool.pytest.ini_options]
addopts = [
'-m "not performance"',
Copy link
Member

Choose a reason for hiding this comment

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

🎩

]
markers = [
"performance: marks test for performance that may unexpectedly fail on slower platforms (not executed by default - select with '-m \"performance\"')",
]

# Types are not enforced but are a good practice
[tool.mypy]
# Exclude virtual environment projects that cause mypy to error
Expand Down
6 changes: 6 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
testpaths = kobo kpi hub
env =
DJANGO_SETTINGS_MODULE=kobo.settings.testing
addopts =
-m "not performance"
markers =
[
performance: marks test for performance that may unexpectedly fail on slower platforms (not executed by default - select with '-m "performance"')
]
LMNTL marked this conversation as resolved.
Show resolved Hide resolved
Loading