10000 chore(test): Make unit tests go faster by aliabbasrizvi · Pull Request #276 · optimizely/python-sdk · GitHub
[go: up one dir, main page]

Skip to content

chore(test): Make unit tests go faster #276

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

Merged
merged 4 commits into from
Jun 26, 2020
Merged

Conversation

aliabbasrizvi
Copy link
Contributor

Noticed a number of tests were taking a long time. Used the command pytest --duration=10 to get top 10 slowest tests.

Before:

5.01s call     tests/test_event_processor.py::BatchEventProcessorTest::test_drain_on_stop
5.00s call     tests/test_config_manager.py::StaticConfigManagerTest::test_get_config_blocks
3.01s call     tests/test_event_processor.py::BatchEventProcessorTest::test_stop_and_start
3.01s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush
3.01s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush_on_mismatch_project_id
3.01s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush_on_mismatch_revision
3.00s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush_on_max_timeout
1.76s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush_once_max_timeout
1.01s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush_max_batch_size
0.70s call     tests/test_optimizely.py::OptimizelyTest::test_get_enabled_features__broadcasts_decision_for_each_feature

Total tests run time: 31.28 seconds

After:

1.01s call     tests/test_config_manager.py::StaticConfigManagerTest::test_get_config_blocks
0.70s call     tests/test_optimizely.py::OptimizelyTest::test_get_enabled_features__broadcasts_decision_for_each_feature
0.36s call     tests/test_optimizely.py::OptimizelyTest::test_activate__whitelisting_overrides_audience_check
0.31s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush_on_mismatch_project_id
0.31s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush_once_max_timeout
0.31s call     tests/test_event_processor.py::BatchEventProcessorTest::test_drain_on_stop
0.31s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush_max_batch_size
0.31s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush_on_max_timeout
0.31s call     tests/test_event_processor.py::BatchEventProcessorTest::test_flush
0.30s call     tests/test_event_processor.py::BatchEventProcessorTest::test_stop_and_start

Total tests run time: 7.05 seconds

@aliabbasrizvi aliabbasrizvi requested a review from a team as a code owner June 26, 2020 22:16
@aliabbasrizvi aliabbasrizvi removed their assignment Jun 26, 2020
@coveralls
Copy link
coveralls commented Jun 26, 2020

Coverage Status

Coverage decreased (-0.001%) to 97.089% when pulling 25d6ccd on ali/fix_test_run into a34b8a8 on master.

@aliabbasrizvi aliabbasrizvi merged commit d743410 into master Jun 26, 2020
@aliabbasrizvi aliabbasrizvi deleted the ali/fix_test_run branch June 26, 2020 23:35
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.

3 participants
0