Repository: statsmodels/statsmodels

Issue:
TST:  varmax uses online data in unit tests
Debian and Ubuntu testing doesn't allow internet access during build and testing

https://launchpadlibrarian.net/223439066/buildlog_ubuntu-vivid-i386.statsmodels_0.7.0~ppa27~revno-1907~ubuntu15.04.1_BUILDING.txt.gz

```
======================================================================
ERROR: Failure: URLError (<urlopen error [Errno -2] Name or service not known>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 519, in makeTest
    return self._makeTest(obj, parent)
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 578, in _makeTest
    return MethodTestCase(obj)
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 345, in __init__
    self.inst = self.cls()
  File "/«PKGBUILDDIR»/debian/python-statsmodels/usr/lib/python2.7/dist-packages/statsmodels/tsa/statespace/tests/test_varmax.py", line 565, in __init__
    true, order=(1,1), trend='nc', error_cov_type='diagonal')
  File "/«PKGBUILDDIR»/debian/python-statsmodels/usr/lib/python2.7/dist-packages/statsmodels/tsa/statespace/tests/test_varmax.py", line 539, in __init__
    dta = webuse('manufac', 'http://www.stata-press.com/data/r12/')
  File "/«PKGBUILDDIR»/debian/python-statsmodels/usr/lib/python2.7/dist-packages/statsmodels/datasets/utils.py", line 48, in webuse
    dta = urlopen(url)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1227, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno -2] Name or service not known>
```



Discussion:
this is still there https://launchpadlibrarian.net/246055802/buildlog_ubuntu-vivid-amd64.statsmodels_0.7.0~ppa27~revno-1938~ubuntu15.04.1_BUILDING.txt.gz

one extra test failure in 

```
======================================================================
FAIL: statsmodels.tsa.statespace.tests.test_dynamic_factor.TestDynamicFactor_ar2_errors.test_mle
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/«PKGBUILDDIR»/debian/python-statsmodels/usr/lib/python2.7/dist-packages/statsmodels/tsa/statespace/tests/test_dynamic_factor.py", line 484, in test_mle
    assert_allclose(res.llf, self.results.llf, atol=1e-3)
  File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 1183, in assert_allclose
    verbose=verbose, header=header)
  File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 644, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-07, atol=0.001

(mismatch 100.0%)
 x: array(607.4054435641632)
 y: array(607.4201043440736)
```

@ChadFulton The `manufac` data is from FRED so it's public domain and no restriction for including in statsmodels.


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -378,7 +378,8 @@ def get_data_files():
         r_ = relpath(r, start=curdir)
         if r_.endswith('results'):
             data_files.update({r_.replace(sep, ".") : ["*.csv",
-                                                       "*.txt"]})
+                                                       "*.txt",
+                                                       "*.dta"]})
 
     return data_files
 


Test patch:
diff --git a/statsmodels/tsa/statespace/tests/results/manufac.dta b/statsmodels/tsa/statespace/tests/results/manufac.dta
new file mode 100644
Binary files /dev/null and b/statsmodels/tsa/statespace/tests/results/manufac.dta differ
diff --git a/statsmodels/tsa/statespace/tests/test_varmax.py b/statsmodels/tsa/statespace/tests/test_varmax.py
--- a/statsmodels/tsa/statespace/tests/test_varmax.py
+++ b/statsmodels/tsa/statespace/tests/test_varmax.py
@@ -12,7 +12,6 @@
 import re
 
 import warnings
-from statsmodels.datasets import webuse
 from statsmodels.tsa.statespace import varmax
 from .results import results_varmax
 from numpy.testing import assert_equal, assert_almost_equal, assert_raises, assert_allclose
@@ -583,8 +582,7 @@ def setup_class(cls, true, order, trend, error_cov_type, cov_type='approx',
                  **kwargs):
         cls.true = true
         # 1960:Q1 - 1982:Q4
-        dta = webuse('manufac', 'http://www.stata-press.com/data/r12/')
-
+        dta = pd.read_stata(current_path + os.sep + 'results' + os.sep + 'manufac.dta')
         dta.index = dta.month
         dta['dlncaputil'] = dta['lncaputil'].diff()
         dta['dlnhours'] = dta['lnhours'].diff()