Skip to content

JHU tests fail #243

@krivard

Description

@krivard

This fix is relatively urgent, since it's blocking our ability to repair JHU in automation. If it turns out the failures are being caused by changes that should not have been merged to main, we should use git revert to undo them, get the code into a state where the tests pass, and submit a new PR for expedited review.

Here's the log I get on a fresh install from main:

============================================================================================================ test session starts =============================================================================================================
platform linux -- Python 3.8.5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1
rootdir: /home/krivard/projects/covid/auto/covidcast-indicators/jhu
plugins: cov-2.10.1
collected 11 items                                                                                                                                                                                                                           

test_geo.py FFFFF                                                                                                                                                                                                                      [ 45%]
test_pull.py ...                                                                                                                                                                                                                       [ 72%]
test_run.py ..                                                                                                                                                                                                                         [ 90%]
test_smooth.py F                                                                                                                                                                                                                       [100%]

================================================================================================================== FAILURES ==================================================================================================================
_______________________________________________________________________________________________________ TestGeoMap.test_incorrect_geo ________________________________________________________________________________________________________

self = <test_geo.TestGeoMap object at 0x7ff239a5b670>

    def test_incorrect_geo(self):
        df = pd.DataFrame(
            {
                "fips": ["53003", "48027", "50103"],
                "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15"],
                "new_counts": [10, 15, 2],
                "cumulative_counts": [100, 20, 45],
                "population": [100, 2100, 300],
            }
        )

        with pytest.raises(ValueError):
>           geo_map(df, "département", 'new_counts')
E           TypeError: geo_map() takes 2 positional arguments but 3 were given

test_geo.py:23: TypeError
___________________________________________________________________________________________________________ TestGeoMap.test_county ___________________________________________________________________________________________________________

self = <test_geo.TestGeoMap object at 0x7ff239a79670>

    def test_county(self):
        df = pd.DataFrame(
            {
                "fips": ["53003", "48027", "50103"],
                "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15"],
                "new_counts": [10, 15, 2],
                "cumulative_counts": [100, 20, 45],
                "population": [100, 2100, 300],
            }
        )

        df_mega = pd.DataFrame(
            {
                "fips": ["13000", "01000"],
                "timestamp": ["2020-02-15", "2020-02-15"],
                "new_counts": [8, 2],
                "cumulative_counts": [80, 12],
                "population": [np.nan, np.nan],
            }
        )

        df = df.append(df_mega)

>       new_df = geo_map(df, "county", 'new_counts')
E       TypeError: geo_map() takes 2 positional arguments but 3 were given

test_geo.py:48: TypeError
___________________________________________________________________________________________________________ TestGeoMap.test_state ____________________________________________________________________________________________________________

self = <test_geo.TestGeoMap object at 0x7ff239a5b850>

    def test_state(self):
        df = pd.DataFrame(
            {
                "fips": ["04001", "04003", "04009", "25023"],
                "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15", "2020-02-15"],
                "new_counts": [10, 15, 2, 13],
                "cumulative_counts": [100, 20, 45, 60],
                "population": [100, 2100, 300, 25],
            }
        )

        df_mega = pd.DataFrame(
            {
                "fips": ["13000", "01000", "04000", "25000"],
                "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15", "2020-02-15"],
                "new_counts": [8, 2, 5, 10],
                "cumulative_counts": [80, 12, 30, 100],
                "population": [np.nan, np.nan, np.nan, np.nan],   
            }
        )

        df = df.append(df_mega)

>       new_df = geo_map(df, "state", 'new_counts')
E       TypeError: geo_map() takes 2 positional arguments but 3 were given

test_geo.py:81: TypeError
____________________________________________________________________________________________________________ TestGeoMap.test_hrr _____________________________________________________________________________________________________________

self = <test_geo.TestGeoMap object at 0x7ff239a7b130>

    def test_hrr(self):
        df = pd.DataFrame(
            {
                "fips": ["13009", "13017", "13021", "09015"],
                "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15", "2020-02-15"],
                "new_counts": [10, 15, 2, 13],
                "cumulative_counts": [100, 20, 45, 60],
                "population": [100, 2100, 300, 25],
            }   
        )   

        # df_mega = pd.DataFrame(
        #     {
        #         "fips": ["90013", "90001"],
        #         "timestamp": ["2020-02-15", "2020-02-15"],
        #         "new_counts": [8, 2],
        #         "cumulative_counts": [80, 12],
        #         "population": [np.nan, np.nan],
        #     }
        # )

        # df = df.append(df_mega)

>       new_df = geo_map(df, "hrr", 'new_counts')
E       TypeError: geo_map() takes 2 positional arguments but 3 were given

test_geo.py:117: TypeError
____________________________________________________________________________________________________________ TestGeoMap.test_msa _____________________________________________________________________________________________________________

self = <test_geo.TestGeoMap object at 0x7ff238d56310>

    def test_msa(self):
        df = pd.DataFrame(
            {
                "fips": ["13009", "13017", "13021", "09015"],
                "timestamp": ["2020-02-15", "2020-02-15", "2020-02-15", "2020-02-15"],
                "new_counts": [10, 15, 2, 13],
                "cumulative_counts": [100, 20, 45, 60],
                "population": [100, 2100, 300, 25],
            }   
        )   

        # df_mega = pd.DataFrame(
        #     {
        #         "fips": ["90013", "90001"],
        #         "timestamp": ["2020-02-15", "2020-02-15"],
        #         "new_counts": [8, 2],
        #         "cumulative_counts": [80, 12],
        #         "population": [np.nan, np.nan],
        #     }
        # )

        # df = df.append(df_mega)

>       new_df = geo_map(df, "msa", 'new_counts')
E       TypeError: geo_map() takes 2 positional arguments but 3 were given

test_geo.py:148: TypeError
___________________________________________________________________________________________________ TestSmooth.test_output_files_smoothed ____________________________________________________________________________________________________

self = <test_smooth.TestSmooth object at 0x7ff238d4c9a0>, run_as_module = None

    def test_output_files_smoothed(self, run_as_module):
    
        dates = [str(x) for x in range(20200701, 20200730)]
    
>       smoothed = pd.read_csv(
            join("../receiving",
                f"{dates[-1]}_state_confirmed_7dav_cumulative_num.csv")
        )

test_smooth.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../env/lib/python3.8/site-packages/pandas/io/parsers.py:686: in read_csv
    return _read(filepath_or_buffer, kwds)
../env/lib/python3.8/site-packages/pandas/io/parsers.py:452: in _read
    parser = TextFileReader(fp_or_buf, **kwds)
../env/lib/python3.8/site-packages/pandas/io/parsers.py:936: in __init__
    self._make_engine(self.engine)
../env/lib/python3.8/site-packages/pandas/io/parsers.py:1168: in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
../env/lib/python3.8/site-packages/pandas/io/parsers.py:1998: in __init__
    self._reader = parsers.TextReader(src, **kwds)
pandas/_libs/parsers.pyx:382: in pandas._libs.parsers.TextReader.__cinit__
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   FileNotFoundError: [Errno 2] No such file or directory: '../receiving/20200729_state_confirmed_7dav_cumulative_num.csv'

pandas/_libs/parsers.pyx:674: FileNotFoundError

----------- coverage: platform linux, python 3.8.5-final-0 -----------
Name                                                                                Stmts   Miss  Cover   Missing
-----------------------------------------------------------------------------------------------------------------
/home/krivard/projects/covid/auto/covidcast-indicators/jhu/delphi_jhu/__init__.py       5      0   100%
/home/krivard/projects/covid/auto/covidcast-indicators/jhu/delphi_jhu/__main__.py       1      1     0%   2
/home/krivard/projects/covid/auto/covidcast-indicators/jhu/delphi_jhu/geo.py           25      1    96%   32
/home/krivard/projects/covid/auto/covidcast-indicators/jhu/delphi_jhu/pull.py          41      1    98%   101
/home/krivard/projects/covid/auto/covidcast-indicators/jhu/delphi_jhu/run.py           48      0   100%
/home/krivard/projects/covid/auto/covidcast-indicators/jhu/delphi_jhu/smooth.py         9      1    89%   33
-----------------------------------------------------------------------------------------------------------------
TOTAL                                                                                 129      4    97%

========================================================================================================== short test summary info ===========================================================================================================
FAILED test_geo.py::TestGeoMap::test_incorrect_geo - TypeError: geo_map() takes 2 positional arguments but 3 were given
FAILED test_geo.py::TestGeoMap::test_county - TypeError: geo_map() takes 2 positional arguments but 3 were given
FAILED test_geo.py::TestGeoMap::test_state - TypeError: geo_map() takes 2 positional arguments but 3 were given
FAILED test_geo.py::TestGeoMap::test_hrr - TypeError: geo_map() takes 2 positional arguments but 3 were given
FAILED test_geo.py::TestGeoMap::test_msa - TypeError: geo_map() takes 2 positional arguments but 3 were given
FAILED test_smooth.py::TestSmooth::test_output_files_smoothed - FileNotFoundError: [Errno 2] No such file or directory: '../receiving/20200729_state_confirmed_7dav_cumulative_num.csv'
======================================================================================================== 6 failed, 5 passed in 4.53s =========================================================================================================

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions