1

I cannot find the test module in my Anaconda's version of Python. Can anyone help me fix this. This module is used by the dpkt library that I am trying to use.

Python 2.7.8 |Anaconda 2.1.0 (x86_64)| (default, Aug 21 2014, 15:21:46)
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import test
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named test
Phani
  • 3,267
  • 4
  • 25
  • 50

2 Answers2

1

Quick Fix: You can checkout a copy of pystone.py from the cpython github repository and copy it to a test directory that is present in your PYTHONPATH. Or you would copy it to a test directory in your python project's root (ugly way).

Perhaps Anaconda Python does not ship with a copy of the test module. This is a standard part of Python 2.7. Other times, users accidentally overwrite their Python standard library's test module with something else. You can try to use the Python version that is shipped with OS X instead. If that fails as well, then try to see which test module is being loaded, and go from there.

import test
print test
Kiran Bandla
  • 686
  • 4
  • 10
  • The repository you linked to seems to be for Python 3.* Do you know about CPython for 2.*? – Phani Jun 29 '15 at 17:58
  • I copied the `test` module from [here](https://www.python.org/downloads/release/python-279/) into Anaconda's Python source. Thanks! – Phani Jun 29 '15 at 18:09
0

Alpine Linux ships a python2-tests package.

the quickest way to fetch it if you don't have an Alpine lxc container is from a main repo here (or apk fetch python2-tests inside lxc).

the .apk can be uncompressed with an archiver to a .tar.gz & then just uncompress again.

Stuart Cardall
  • 2,099
  • 24
  • 18