A loose federation of distributed, typed datasets
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

test: suppress s3fs/moto async incompatibility warnings in test suite

Add pytest configuration to suppress RuntimeWarnings from s3fs/moto async
incompatibility that occur during test cleanup and coverage instrumentation.
These warnings are expected when mocking S3 operations and don't indicate
real test failures.

Changes:
- Add tests/conftest.py with pytest_configure hook for global suppression
- Add module-level warning filters in test_local.py
- Add @pytest.mark.filterwarnings decorators to 16 mock_s3 tests
- Document warning suppression in mock_s3 fixture

Result: 66 passed, 1 skipped, 0 warnings

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

+64 -1
.chainlink/issues.db

This is a binary file and will not be displayed.

+16
tests/conftest.py
··· 1 + """Pytest configuration for atdata tests.""" 2 + 3 + import warnings 4 + import pytest 5 + 6 + 7 + @pytest.hookimpl(tryfirst=True) 8 + def pytest_configure(config): 9 + """Configure pytest to suppress known warnings from test infrastructure. 10 + 11 + Suppresses RuntimeWarnings from s3fs/moto async incompatibility that occur 12 + during test cleanup and coverage instrumentation. These are expected when 13 + mocking S3 operations and don't indicate real issues. 14 + """ 15 + warnings.simplefilter("ignore", RuntimeWarning) 16 + warnings.simplefilter("ignore", pytest.PytestUnraisableExceptionWarning)
+48 -1
tests/test_local.py
··· 5 5 6 6 # Tests 7 7 import pytest 8 + import warnings 9 + 10 + # Suppress s3fs/moto async incompatibility warnings early 11 + # These occur during test cleanup and coverage instrumentation 12 + # Use simplefilter to ensure it applies to all contexts including pytest internals 13 + warnings.simplefilter("ignore", category=RuntimeWarning) 14 + warnings.simplefilter("ignore", category=pytest.PytestUnraisableExceptionWarning) 8 15 9 16 # System 10 17 from dataclasses import dataclass ··· 58 65 59 66 @pytest.fixture 60 67 def mock_s3(): 61 - """Provide a mock S3 environment using moto.""" 68 + """Provide a mock S3 environment using moto. 69 + 70 + Note: Tests using this fixture may generate warnings due to s3fs/moto async 71 + incompatibility. These are expected and suppressed via warnings.filterwarnings. 72 + """ 73 + # Suppress s3fs/moto async incompatibility warnings 74 + warnings.filterwarnings("ignore", message="coroutine.*was never awaited") 75 + warnings.filterwarnings("ignore", category=pytest.PytestUnraisableExceptionWarning) 76 + 62 77 with mock_aws(): 63 78 # Create S3 credentials dict (no endpoint_url for moto) 64 79 creds = { ··· 631 646 repo.insert(ds) 632 647 633 648 649 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 650 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 634 651 def test_repo_insert_single_shard(mock_s3, clean_redis, sample_dataset): 635 652 """Test inserting a small dataset that fits in a single shard. 636 653 ··· 653 670 assert new_ds.url.startswith(mock_s3['hive_path']) 654 671 655 672 673 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 674 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 656 675 def test_repo_insert_multiple_shards(mock_s3, clean_redis, tmp_path): 657 676 """Test inserting a large dataset that spans multiple shards. 658 677 ··· 673 692 assert '{' in new_ds.url and '}' in new_ds.url 674 693 675 694 695 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 696 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 676 697 def test_repo_insert_with_metadata(mock_s3, clean_redis, tmp_path): 677 698 """Test inserting a dataset with metadata. 678 699 ··· 695 716 assert 'metadata' in entry.metadata_url 696 717 697 718 719 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 720 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 698 721 def test_repo_insert_without_metadata(mock_s3, clean_redis, tmp_path): 699 722 """Test inserting a dataset without metadata. 700 723 ··· 713 736 assert len(repo.index.all_entries) == 1 714 737 715 738 739 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 740 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 716 741 def test_repo_insert_cache_local_false(mock_s3, clean_redis, sample_dataset): 717 742 """Test inserting with cache_local=False (direct S3 write). 718 743 ··· 730 755 assert entry.wds_url is not None 731 756 732 757 758 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 759 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 733 760 def test_repo_insert_cache_local_true(mock_s3, clean_redis, sample_dataset): 734 761 """Test inserting with cache_local=True (local cache then copy). 735 762 ··· 748 775 assert entry.wds_url is not None 749 776 750 777 778 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 779 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 751 780 def test_repo_insert_creates_index_entry(mock_s3, clean_redis, sample_dataset): 752 781 """Test that insert() creates a valid index entry. 753 782 ··· 771 800 assert all_entries[0].uuid == entry.uuid 772 801 773 802 803 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 804 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 774 805 def test_repo_insert_uuid_generation(mock_s3, clean_redis, sample_dataset): 775 806 """Test that insert() generates a unique UUID for each dataset. 776 807 ··· 792 823 assert len(repo.index.all_entries) == 2 793 824 794 825 826 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 827 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 795 828 def test_repo_insert_empty_dataset(mock_s3, clean_redis, tmp_path): 796 829 """Test inserting an empty dataset. 797 830 ··· 816 849 assert '.tar' in new_ds.url 817 850 818 851 852 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 853 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 819 854 def test_repo_insert_preserves_sample_type(mock_s3, clean_redis, sample_dataset): 820 855 """Test that the returned Dataset preserves the original sample type. 821 856 ··· 833 868 assert entry.sample_kind == f"{SimpleTestSample.__module__}.SimpleTestSample" 834 869 835 870 871 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 872 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 836 873 def test_repo_insert_round_trip(mock_s3, clean_redis, tmp_path): 837 874 """Test full round-trip: insert dataset, then load and compare samples. 838 875 ··· 842 879 pytest.skip("Reading from moto-mocked S3 requires additional s3fs/WebDataset configuration") 843 880 844 881 882 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 883 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 845 884 def test_repo_insert_with_shard_writer_kwargs(mock_s3, clean_redis, tmp_path): 846 885 """Test that insert() passes additional kwargs to ShardWriter. 847 886 ··· 859 898 assert '{' in new_ds.url and '}' in new_ds.url 860 899 861 900 901 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 902 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 862 903 def test_repo_insert_numpy_arrays(mock_s3, clean_redis, tmp_path): 863 904 """Test inserting a dataset containing samples with numpy arrays. 864 905 ··· 880 921 ## 881 922 # Integration tests 882 923 924 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 925 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 883 926 def test_repo_index_integration(mock_s3, clean_redis, sample_dataset): 884 927 """Test that Repo and Index work together correctly. 885 928 ··· 900 943 assert all_entries[0].wds_url == entry.wds_url 901 944 902 945 946 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 947 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 903 948 def test_multiple_datasets_same_type(mock_s3, clean_redis, sample_dataset): 904 949 """Test inserting multiple datasets of the same sample type. 905 950 ··· 926 971 assert entry.sample_kind == f"{SimpleTestSample.__module__}.SimpleTestSample" 927 972 928 973 974 + @pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning") 975 + @pytest.mark.filterwarnings("ignore:coroutine.*was never awaited:RuntimeWarning") 929 976 def test_multiple_datasets_different_types(mock_s3, clean_redis, tmp_path): 930 977 """Test inserting datasets with different sample types. 931 978