|
27 | 27 |
|
28 | 28 | IMG_URL = "https://picsum.photos/200/300.jpg" |
29 | 29 | SMALL_DATASET_URL = "https://storage.googleapis.com/lb-artifacts-testing-public/sdk_integration_test/potato.jpeg" |
30 | | -DATA_ROW_PROCESSING_WAIT_TIMEOUT_SECONDS = 30 |
31 | | -DATA_ROW_PROCESSING_WAIT_SLEEP_INTERNAL_SECONDS = 5 |
32 | 30 |
|
33 | 31 |
|
34 | 32 | class Environ(Enum): |
@@ -458,10 +456,8 @@ def configured_batch_project_with_label(project, dataset, data_row, |
458 | 456 | One label is already created and yielded when using fixture |
459 | 457 | """ |
460 | 458 | data_rows = [dr.uid for dr in list(dataset.data_rows())] |
461 | | - project._wait_until_data_rows_are_processed( |
462 | | - data_row_ids=data_rows, |
463 | | - wait_processing_max_seconds=DATA_ROW_PROCESSING_WAIT_TIMEOUT_SECONDS, |
464 | | - sleep_interval=DATA_ROW_PROCESSING_WAIT_SLEEP_INTERNAL_SECONDS) |
| 459 | + project._wait_until_data_rows_are_processed(data_row_ids=data_rows, |
| 460 | + sleep_interval=3) |
465 | 461 | project.create_batch("test-batch", data_rows) |
466 | 462 | project.data_row_ids = data_rows |
467 | 463 |
|
@@ -604,7 +600,6 @@ def configured_project_with_complex_ontology(client, initial_dataset, rand_gen, |
604 | 600 | project.setup(editor, ontology.asdict()) |
605 | 601 |
|
606 | 602 | yield [project, data_row] |
607 | | - dataset.delete() |
608 | 603 | project.delete() |
609 | 604 |
|
610 | 605 |
|
@@ -825,35 +820,31 @@ def upload_invalid_data_rows_for_dataset(dataset: Dataset): |
825 | 820 | task.wait_till_done() |
826 | 821 |
|
827 | 822 |
|
828 | | -@pytest.mark.skipif("FIXTURE_PROFILE" not in os.environ) |
829 | 823 | def pytest_configure(): |
830 | 824 | pytest.report = defaultdict(int) |
831 | | - pytest.data_row_report = {'times': 0, 'num_rows': 0} |
832 | 825 |
|
833 | 826 |
|
834 | | -@pytest.mark.skipif("FIXTURE_PROFILE" not in os.environ) |
835 | 827 | @pytest.hookimpl(hookwrapper=True) |
836 | | -def pytest_fixture_setup(fixturedef, request): |
| 828 | +def pytest_fixture_setup(fixturedef): |
837 | 829 | start = time.time() |
838 | 830 | yield |
839 | | - |
840 | 831 | end = time.time() |
841 | 832 |
|
842 | 833 | exec_time = end - start |
843 | | - pytest.report[fixturedef.argname] += exec_time |
| 834 | + if "FIXTURE_PROFILE" in os.environ: |
| 835 | + pytest.report[fixturedef.argname] += exec_time |
844 | 836 |
|
845 | 837 |
|
846 | | -@pytest.mark.skipif("FIXTURE_PROFILE" not in os.environ) |
847 | 838 | @pytest.fixture(scope='session', autouse=True) |
848 | 839 | def print_perf_summary(): |
849 | 840 | yield |
850 | 841 |
|
851 | | - sorted_dict = dict( |
852 | | - sorted(pytest.report.items(), key=lambda item: item[1], reverse=True)) |
853 | | - num_of_entries = 10 if len(sorted_dict) >= 10 else len(sorted_dict) |
854 | | - slowest_fixtures = [ |
855 | | - (aaa, sorted_dict[aaa]) for aaa in islice(sorted_dict, num_of_entries) |
856 | | - ] |
857 | | - print("\nTop slowest fixtures:\n", slowest_fixtures, file=sys.stderr) |
858 | | - print("Data row report:\n", pytest.data_row_report, file=sys.stderr) |
859 | | - # assert False |
| 842 | + if "FIXTURE_PROFILE" in os.environ: |
| 843 | + sorted_dict = dict( |
| 844 | + sorted(pytest.report.items(), |
| 845 | + key=lambda item: item[1], |
| 846 | + reverse=True)) |
| 847 | + num_of_entries = 10 if len(sorted_dict) >= 10 else len(sorted_dict) |
| 848 | + slowest_fixtures = [(aaa, sorted_dict[aaa]) |
| 849 | + for aaa in islice(sorted_dict, num_of_entries)] |
| 850 | + print("\nTop slowest fixtures:\n", slowest_fixtures, file=sys.stderr) |
0 commit comments