Closed rickecon closed 1 year ago
@jdebacker. It looks like the CI test error in this PR and in your PR #375 is coming from changes to the bokeh
package. I think this come from Bokeh's changes in the current version, which is 3.1.1.
@jdebacker. I added some changes to this PR to make CCC run and test only on Python >=3.9, which is the requirement for the most recent version of Bokeh (v.3.1.1). My main update of the old bokeh.models.widgets.Panel
and bokeh.models.widgets.Tabs
packages to bokeh.models.TabsPanel
and bokeh.models.Tabs
, respectively, solves the import error test failures. Now I am just getting 11 failures that are all attribute errors with the TabsPanel()
class. These are the pytest
results I get on my local machine with this updated conda environment.
============================= test session starts ==============================
platform darwin -- Python 3.11.4, pytest-7.3.2, pluggy-1.0.0
rootdir: /Users/richardevans/Docs/Economics/OSE/Cost-of-Capital-Calculator
configfile: pytest.ini
testpaths: ccc, cs-config/cs_config/tests
plugins: xdist-3.3.1
collected 127 items
ccc/tests/test_calcfunctions.py ............... [ 11%]
ccc/tests/test_calculator.py ..................FFFFFF..... [ 34%]
ccc/tests/test_data.py ...... [ 39%]
ccc/tests/test_get_taxcalc_rates.py .FF.F.. [ 44%]
ccc/tests/test_parameters.py .................... [ 60%]
ccc/tests/test_paramfunctions.py ........... [ 69%]
ccc/tests/test_run_ccc.py .. [ 70%]
ccc/tests/test_start_years.py ......... [ 77%]
ccc/tests/test_utils.py ..................... [ 94%]
cs-config/cs_config/tests/test_functions.py .....FF [100%]
=================================== FAILURES ===================================
...
=========================== short test summary info ============================
FAILED ccc/tests/test_calculator.py::test_range_plot[Corporate] - AttributeError: unexpected attribute 'plot_width' to figure, similar attrib...
FAILED ccc/tests/test_calculator.py::test_range_plot[Non-Corporate] - AttributeError: unexpected attribute 'plot_width' to figure, similar attrib...
FAILED ccc/tests/test_calculator.py::test_grouped_bar[Corporate] - AttributeError: unexpected attribute 'plot_height' to figure, similar attri...
FAILED ccc/tests/test_calculator.py::test_grouped_bar[Non-Corporate] - AttributeError: unexpected attribute 'plot_height' to figure, similar attri...
FAILED ccc/tests/test_calculator.py::test_asset_bubble - AttributeError: unexpected attribute 'plot_height' to figure, similar attri...
FAILED ccc/tests/test_calculator.py::test_bubble_widget - AttributeError: unexpected attribute 'plot_height' to figure, similar attri...
FAILED ccc/tests/test_get_taxcalc_rates.py::test_get_calculator[data=PUF] - ValueError: could not read puf.csv data from egg
FAILED ccc/tests/test_get_taxcalc_rates.py::test_get_calculator[data=None] - ValueError: could not read puf.csv data from egg
FAILED ccc/tests/test_get_taxcalc_rates.py::test_get_rates - assert False
FAILED cs-config/cs_config/tests/test_functions.py::TestFunctions1::test_run_model - AttributeError: unexpected attribute 'plot_height' to figure, similar attri...
FAILED cs-config/cs_config/tests/test_functions.py::test_param_effect - AttributeError: unexpected attribute 'plot_height' to figure, similar attri...
=========== 11 failed, 116 passed, 39 warnings in 298.79s (0:04:58) ============
test_calculator.py
and the two errors in test_functions.py
are just needing to set the bokeh TabsPanel attributes to height
and width
, instead of plot_height
and plot_width
.test_get_taxcalc_rates.py
are just me not having the puf.csv
file in my directory.test_get_taxcalc_rates.py
is a failing np.allclose()
on output. I will have to check on what this is supposed to be. Maybe all we have to do is update the validation values.@jdebacker. I fixed all the Bokeh errors, and I also fixed some tickformatter package errors. When I create a new ccc-dev
conda package and run all the pytest
tests on my local machine, I get the following three errors in the test_get_taxcalc_rates.py
tests.
=============================================== test session starts ===============================================
platform darwin -- Python 3.11.4, pytest-7.3.2, pluggy-1.0.0
rootdir: /Users/richardevans/Docs/Economics/OSE/Cost-of-Capital-Calculator
configfile: pytest.ini
testpaths: ccc, cs-config/cs_config/tests
plugins: xdist-3.3.1
collected 127 items
ccc/tests/test_calcfunctions.py ............... [ 11%]
ccc/tests/test_calculator.py ............................. [ 34%]
ccc/tests/test_data.py ...... [ 39%]
ccc/tests/test_get_taxcalc_rates.py .FF.F.. [ 44%]
ccc/tests/test_parameters.py .................... [ 60%]
ccc/tests/test_paramfunctions.py ........... [ 69%]
ccc/tests/test_run_ccc.py .. [ 70%]
ccc/tests/test_start_years.py ......... [ 77%]
ccc/tests/test_utils.py ..................... [ 94%]
cs-config/cs_config/tests/test_functions.py ....... [100%]
==================================================== FAILURES =====================================================
...
============================================= short test summary info =============================================
FAILED ccc/tests/test_get_taxcalc_rates.py::test_get_calculator[data=PUF] - ValueError: could not read puf.csv data from egg
FAILED ccc/tests/test_get_taxcalc_rates.py::test_get_calculator[data=None] - ValueError: could not read puf.csv data from egg
FAILED ccc/tests/test_get_taxcalc_rates.py::test_get_rates - assert False
============================= 3 failed, 124 passed, 41 warnings in 322.67s (0:05:22) ==============================
puf.csv
file available or in the right place. I don't know how to fix this.np.allclose()
fail. I think this one is just you making a judgement call as to whether the known values against which the model output is tested need to be updated.I think if you help me fix these last three errors (the puf.csv
one should be easy), this will be a nice update to the Cost-of-Calculator model.
@rickecon Thanks for this PR!
I'm going to merge this and then I'll test against the PUF file. I believe the ccc/tests/test_get_taxcalc_rates.py::test_get_rates
failure is because there's a new version of Tax-Calculator. I'll confirm and update the expected rates for that as well.
@jdebacker. It also looked like some of the errors were coming in the Windows OS tests. I updated the OS matrix in build_and_test.yml
to include all three operating systems. Worst case scenario, you could delete the windows-latest
tests.
os: [ubuntu-latest, macos-latest, windows-latest]
This PR adds the following two references to the
citations.bib
file:cc: @jdebacker