PolicyEngine / policyengine-us

The PolicyEngine US Python package contains a rules engine of the US tax-benefit system, and microdata generation for microsimulation analysis.
https://policyengine.org/us
GNU Affero General Public License v3.0
100 stars 174 forks source link

Local "make test" failure with 0.291.0 version #2137

Closed martinholmer closed 1 year ago

martinholmer commented 1 year ago

After updating a development branch to the 0.291.0 version code, the make test command fails with the following error message:

=================================== FAILURES ===================================
____________________________ test_racial_breakdowns ____________________________

    def test_racial_breakdowns():
        from policyengine_us import Microsimulation

        race = Microsimulation().calculate("race")
>       assert (
            race == "WHITE"
        ).sum() > 0, "No people of racial category WHITE in the CPS"
E       AssertionError: No people of racial category WHITE in the CPS
E       assert 0.0 > 0
E        +  where 0.0 = <bound method MicroSeries.sum of         value       weight\n0       False  2354.189941\n1       False  1933.500000\n2   ...  0.000000\n152729  False     0.000000\n152730  False     0.000000\n152731  False     0.000000\n\n[152732 rows x 2 columns]>()
E        +    where <bound method MicroSeries.sum of         value       weight\n0       False  2354.189941\n1       False  1933.500000\n2   ...  0.000000\n152729  False     0.000000\n152730  False     0.000000\n152731  False     0.000000\n\n[152732 rows x 2 columns]> =         value       weight\n0       OTHER  2354.189941\n1       OTHER  1933.500000\n2       OTHER  1652.650024\n3       OT...   0.000000\n152729  OTHER     0.000000\n152730  OTHER     0.000000\n152731  OTHER     0.000000\n\n[152732 rows x 2 columns] == 'WHITE'.sum

policyengine_us/tests/microsimulation/test_racial_breakdowns.py:5: AssertionError
=========================== short test summary info ============================
FAILED policyengine_us/tests/microsimulation/test_racial_breakdowns.py::test_racial_breakdowns
================== 1 failed, 1414 passed, 7 skipped in 33.38s ==================

There is nothing I've seen that says contributors need to do anything special in order to use the 0.291.0+ versions.

@nikhilwoodruff, are there, in fact, any special things to do in order to have a PolicyEngineUS model that actually works after #2135? Or are the code changes in the merged #2135 incomplete or wrong?

nikhilwoodruff commented 1 year ago

Sorry, I'd assumed the datasets would auto-update for some reason. Will revisit this today with a fix.

martinholmer commented 1 year ago

@nikhilwoodruff, on GitHub the Linux tests pass but a couple of Windows tests fail. For details, see pull request #2138.

nikhilwoodruff commented 1 year ago

OK @martinholmer a little perplexed by those Windows test failures that have occurred a few times recently. In all cases re-running the action with no change has passed the tests.

martinholmer commented 1 year ago

@nikhilwoodruff said:

[I'm] a little perplexed by those Windows test failures that have occurred a few times recently. In all cases re-running the action with no change has passed the tests.

Sounds like your changes in #2135 are a bit flakey.

martinholmer commented 1 year ago

Using the 0.292.0 code on my iMac, I still get the same test failure as reported above:

FAILED policyengine_us/tests/microsimulation/test_racial_breakdowns.py::test_racial_breakdowns

How do you expect to attract/retain volunteers with the development environment so chaotic?

nikhilwoodruff commented 1 year ago

@martinholmer running the following should fix all data issues:

from policyengine_us.data import CPS_2022

CPS_2022().download()

Looking at other GitHub repo practices, we should probably figure out the best approach for this situation, where a downloaded asset has a breaking change in its update. Will give it some thought but open to ideas.