diff --git a/tests/test_automated_data_fetcher.py b/tests/test_automated_data_fetcher.py index 3178544..45e8027 100644 --- a/tests/test_automated_data_fetcher.py +++ b/tests/test_automated_data_fetcher.py @@ -170,6 +170,7 @@ class TestDataFetcher: @patch("automated_data_fetcher.pb.batting_stats_bref") @patch("automated_data_fetcher.pb.pitching_stats_bref") + @pytest.mark.asyncio async def test_fetch_baseball_reference_data( self, mock_pitching, @@ -206,6 +207,7 @@ class TestDataFetcher: @patch("automated_data_fetcher.pb.batting_stats") @patch("automated_data_fetcher.pb.pitching_stats") + @pytest.mark.asyncio async def test_fetch_fangraphs_data( self, mock_pitching, @@ -231,6 +233,7 @@ class TestDataFetcher: @patch("automated_data_fetcher.pb.batting_stats_range") @patch("automated_data_fetcher.pb.pitching_stats_range") + @pytest.mark.asyncio async def test_fetch_fangraphs_data_with_dates( self, mock_pitching, @@ -253,6 +256,7 @@ class TestDataFetcher: mock_pitching.assert_called_once_with(start_date, end_date) @patch("automated_data_fetcher.get_all_pybaseball_ids") + @pytest.mark.asyncio async def test_get_active_players_existing_function(self, mock_get_ids, fetcher): """Test getting player IDs using existing function""" mock_get_ids.return_value = ["12345", "67890", "11111"] @@ -264,6 +268,7 @@ class TestDataFetcher: @patch("automated_data_fetcher.get_all_pybaseball_ids") @patch("automated_data_fetcher.pb.batting_stats") + @pytest.mark.asyncio async def test_get_active_players_fallback( self, mock_batting, mock_get_ids, fetcher, sample_batting_data ): @@ -279,6 +284,7 @@ class TestDataFetcher: assert result == expected_ids @patch("automated_data_fetcher.pb.get_splits") + @pytest.mark.asyncio async def test_fetch_player_splits( self, mock_get_splits, fetcher, sample_splits_data ): @@ -333,6 +339,7 @@ class TestLiveSeriesDataFetcher: @patch.object(DataFetcher, "fetch_baseball_reference_data") @patch.object(DataFetcher, "fetch_fangraphs_data") + @pytest.mark.asyncio async def test_fetch_live_data(self, mock_fg_data, mock_bref_data, live_fetcher): """Test fetching live series data""" # Mock return values @@ -360,6 +367,7 @@ class TestUtilityFunctions: """Test cases for utility functions""" @patch("automated_data_fetcher.DataFetcher") + @pytest.mark.asyncio async def test_fetch_season_data(self, mock_fetcher_class): """Test fetch_season_data function""" # Create mock fetcher instance @@ -389,6 +397,7 @@ class TestUtilityFunctions: assert any("AUTOMATED DOWNLOAD COMPLETE" in call for call in print_calls) @patch("automated_data_fetcher.LiveSeriesDataFetcher") + @pytest.mark.asyncio async def test_fetch_live_series_data(self, mock_fetcher_class): """Test fetch_live_series_data function""" # Create mock fetcher instance @@ -416,6 +425,7 @@ class TestErrorHandling: return DataFetcher(2023, "Season") @patch("automated_data_fetcher.pb.pitching_stats_bref") + @pytest.mark.asyncio async def test_fetch_baseball_reference_data_error(self, mock_pitching, fetcher): """Test error handling in Baseball Reference data fetch""" # Mock function to raise an exception @@ -425,6 +435,7 @@ class TestErrorHandling: await fetcher.fetch_baseball_reference_data() @patch("automated_data_fetcher.pb.batting_stats") + @pytest.mark.asyncio async def test_fetch_fangraphs_data_error(self, mock_batting, fetcher): """Test error handling in FanGraphs data fetch""" # Mock function to raise an exception @@ -435,6 +446,7 @@ class TestErrorHandling: @patch("automated_data_fetcher.get_all_pybaseball_ids") @patch("automated_data_fetcher.pb.batting_stats") + @pytest.mark.asyncio async def test_get_active_players_complete_failure( self, mock_batting, mock_get_ids, fetcher ): @@ -449,6 +461,7 @@ class TestErrorHandling: assert result == [] @patch("automated_data_fetcher.pb.get_splits") + @pytest.mark.asyncio async def test_fetch_player_splits_individual_errors( self, mock_get_splits, fetcher ): @@ -479,6 +492,7 @@ class TestIntegration: """Integration tests that require network access""" @pytest.mark.skip(reason="Requires network access and may be slow") + @pytest.mark.asyncio async def test_real_data_fetch(self): """Test fetching real data from pybaseball (skip by default)""" fetcher = DataFetcher(2022, "Season") # Use a complete season