Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP/TST: enable/mark mangled/commented-out tests #5768

Merged
merged 7 commits into from
Jul 12, 2019

Conversation

jbrockmendel
Copy link
Contributor

Based on a read through the coverage statistics for test files.

Might be worth adding except ImportError: to the .coveragerc exclusions; then again we might want to specifically make sure to test no-matplotlib environments.

Not remotely confident that the addition of cvxopt is in the right place. Suggestions welcome.

@ChadFulton there are a bunch of un-hit cases in statespace test files separate from the ones marked here, e.g. https://coveralls.io/builds/23474023/source?filename=statsmodels%2Ftsa%2Fstatespace%2Ftests%2Ftest_simulation_smoothing.py#L441 any thoughts on how/whether these can/should be reached? (no hurry, there's plenty in this WIP to keep me occupied for a bit)

@pep8speaks
Copy link

pep8speaks commented May 21, 2019

Hello @jbrockmendel! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-07-12 13:22:53 UTC

@@ -101,22 +101,26 @@ def test_smoothconf(self):

#assert_allclose(fitted, res_fitted, rtol=0, atol=1e-6)

def t_est_smoothconf_data(self):
@pytest.mark.smoke # TOOD: make this an actual test?
def test_smoothconf_data(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one might be expensive
maybe better not to run it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also add slow marker

@@ -926,11 +926,10 @@ def affine_transformed(self, shift, scale_matrix):

Returns
-------
mvt : instance of MVT
instance of multivariate t distribution given by affine
mvt : instance of MVNormal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mvt -> mvn

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. BTW while looking through the sandbox.distributions code I found a lot of it to be really nice (also TheilGLS stood out). I'm looking forward to seeing what else you have in mind in this area.

@@ -65,61 +65,54 @@ def test_basic(self):


def test_basic_method(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't change this,
if hasattr(self, 'res1m') should stay in both test functions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Are there more forthcoming cases where the attribute doesn't exist yet?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most likely or maybe, support for constrained fitting is still missing in some models, e.g. my discrete PR to add offset and fit_constrained to Binary models.
I don't remember the details of the unit tests without going through them.

This would change the usage for subclasses, so it's not a innocent change and should stay as the original author (I) intended.

@josef-pkt
Copy link
Member

looks good overall

don't change statsmodels/discrete/tests/test_constrained.py
and a few other comments

the one kde test is the only one that looks expensive to add (and will not assert anything)

pytest.skip('Unable to retrieve file - skipping test')
try:
duncan = get_rdataset("Duncan", "carData", cache=cur_dir)
except (HTTPError, URLError):
except (HTTPError, URLError): # pragma: no cover
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already in coveragerc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://coveralls.io/builds/23535701/source?filename=statsmodels/datasets/tests/test_utils.py

Looks like its not in coveragerc_travis. I'll update it there. I missed the discussion that led to having multiple coveragerc files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we could get back to just one coveragerc file, we could drop that and put it into setup.cfg

message = ('test: ll_0 not available, llnull=%6.4F'
% res1.llnull)
warnings.warn(message)
res1 = (self.res1m if not hasattr(self.res1m, '_results')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could fix the indentation. If not hasattr(): skip then no indentation needed below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

josef and I are working together pretty well in this thread, I'd like to keep that going by not pushing on this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the problem with intentation?
this looks like a regular if else to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is

if cond:
    Lots of lines fo test code:
else:
    skip

Better hygiene is to do

if not cond:
    skip
lots of test code (<- 1 level less indent, and no need to read to the bottom to figure out what is going on)

This is just hygiene, so clearly not essential.

@@ -7,7 +7,7 @@

try:
import matplotlib.pyplot as plt
except ImportError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add except ImportError to coverage. This should be skipped everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@jbrockmendel
Copy link
Contributor Author

jbrockmendel commented May 22, 2019

Updated with suggested edits.

Outstanding questions:

  • is the added pip install cvxopt in the appropriate place or can a better one be suggested?

My inclination is to separate out the passing parts of this and keep a) the newly enabled and failing tests and b) the FIXME/TODO comments in a WIP PR that I'll slowly whittle down. Thoughts?

.travis.yml Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 23, 2019

Codecov Report

Merging #5768 into master will increase coverage by 0.33%.
The diff coverage is 92.59%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5768      +/-   ##
==========================================
+ Coverage    82.3%   82.64%   +0.33%     
==========================================
  Files         593      593              
  Lines       93728    93639      -89     
  Branches    10356     9605     -751     
==========================================
+ Hits        77146    77385     +239     
+ Misses      14185    13868     -317     
+ Partials     2397     2386      -11
Impacted Files Coverage Δ
...dels/nonparametric/tests/test_kernel_regression.py 100% <ø> (+4.08%) ⬆️
statsmodels/tsa/tests/test_holtwinters.py 100% <ø> (ø) ⬆️
statsmodels/regression/tests/test_glsar_stata.py 100% <ø> (+4.76%) ⬆️
statsmodels/genmod/tests/test_glm.py 99.48% <ø> (+0.41%) ⬆️
statsmodels/tsa/tests/test_stattools.py 98.92% <ø> (ø) ⬆️
statsmodels/graphics/tests/test_dotplot.py 100% <ø> (+2.63%) ⬆️
statsmodels/duration/tests/test_survfunc.py 100% <ø> (+2.65%) ⬆️
statsmodels/graphics/tests/test_boxplots.py 100% <ø> (+3.03%) ⬆️
statsmodels/tsa/statespace/tests/test_kalman.py 95.36% <ø> (ø) ⬆️
statsmodels/multivariate/tests/test_factor.py 93.44% <ø> (+2.81%) ⬆️
... and 93 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68d5436...3f79cab. Read the comment docs.

@codecov
Copy link

codecov bot commented May 23, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@5f086e8). Click here to learn what that means.
The diff coverage is 92.52%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #5768   +/-   ##
=========================================
  Coverage          ?   82.79%           
=========================================
  Files             ?      595           
  Lines             ?    93754           
  Branches          ?    10332           
=========================================
  Hits              ?    77628           
  Misses            ?    13748           
  Partials          ?     2378
Impacted Files Coverage Δ
statsmodels/stats/tests/test_weightstats.py 98.52% <ø> (ø)
statsmodels/tools/tests/test_grouputils.py 98.79% <ø> (ø)
statsmodels/tsa/statespace/tests/test_kalman.py 95.36% <ø> (ø)
statsmodels/tools/tests/test_numdiff.py 98.37% <ø> (ø)
statsmodels/base/tests/test_data.py 100% <ø> (ø)
...dels/nonparametric/tests/test_kernel_regression.py 100% <ø> (ø)
statsmodels/tsa/tests/test_holtwinters.py 100% <ø> (ø)
statsmodels/regression/tests/test_glsar_stata.py 100% <ø> (ø)
statsmodels/tools/tests/test_decorators.py 100% <ø> (ø)
statsmodels/stats/libqsturng/tests/test_qsturng.py 84% <ø> (ø)
... and 26 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f086e8...6ddafc0. Read the comment docs.

@coveralls
Copy link

coveralls commented May 23, 2019

Coverage Status

Coverage increased (+0.3%) to 85.501% when pulling 6ddafc0 on jbrockmendel:typos into 5f086e8 on statsmodels:master.

@bashtage bashtage closed this May 23, 2019
@bashtage bashtage reopened this May 23, 2019
@bashtage
Copy link
Member

Clopen to trigger CI

@bashtage
Copy link
Member

Needs rebase

@jbrockmendel
Copy link
Contributor Author

Looks like cvxopt doesn’t provide a manylinux wheel for py34. Not sure where the six version mismatch comes from. Fine to wait until after we drop py34 since this isn’t merge-ready anyway.

@@ -43,7 +43,7 @@ def _R_compat_quantile(x, probs):
def _eval_bspline_basis(x, knots, degree, deriv='all', include_intercept=True):
try:
from scipy.interpolate import splev
except ImportError: # pragma: no cover
except ImportError:
raise ImportError("spline functionality requires scipy")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems unreachable. maybe its a specific scipy version?

@bashtage
Copy link
Member

@jbrockmendel Could you rebase so we can see if this is OK now?

@bashtage bashtage merged commit c5e665e into statsmodels:master Jul 12, 2019
@jbrockmendel jbrockmendel deleted the typos branch July 13, 2019 00:46
@bashtage bashtage added this to the 0.11 milestone Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants