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

Add Morfessor and Sklearn to Test Requirements in setup.py #1324

Closed
aptlin opened this issue May 15, 2017 · 2 comments
Closed

Add Morfessor and Sklearn to Test Requirements in setup.py #1324

aptlin opened this issue May 15, 2017 · 2 comments
Labels
difficulty easy Easy issue: required small fix testing Issue related with testing (code, documentation, etc)

Comments

@aptlin
Copy link

aptlin commented May 15, 2017

Description

  1. testAddMorphemesToEmbeddings imports morfessor, but the module is not declared as a dependence for testing in setup.py. Will adding a try-except loop help?
  2. Similarly, test_sklearn_integration imports sklearn, but it is not mentioned in setup.py.

Steps/Code/Corpus to Reproduce

python setup.py test

Expected Results

Clear installation.

Actual Results

======================================================================
ERROR: testAddMorphemesToEmbeddings (gensim.test.test_varembed_wrapper.TestVarembed)
Test add morphemes to Embeddings
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/nix-build-python3.5-gensim-2.1.0.drv-0/gensim-2.1.0/gensim/models/wrappers/varembed.py", line 68, in load_varembed_format
    import morfessor
ImportError: No module named 'morfessor'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/nix-build-python3.5-gensim-2.1.0.drv-0/gensim-2.1.0/gensim/test/test_varembed_wrapper.py", line 56, in testAddMorphemesToEmbeddings
    vectors=varembed_model_vector_file, morfessor_model=varembed_model_morfessor_file)
  File "/tmp/nix-build-python3.5-gensim-2.1.0.drv-0/gensim-2.1.0/gensim/models/wrappers/varembed.py", line 74, in load_varembed_format
    raise ImportError('Could not import morfessor.')
ImportError: Could not import morfessor.

======================================================================
ERROR: test_sklearn_integration (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_sklearn_integration
Traceback (most recent call last):
  File "/nix/store/ngfvnb22lh72z8prslmfdd2aiis5z08p-python3-3.5.3/lib/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/tmp/nix-build-python3.5-gensim-2.1.0.drv-0/gensim-2.1.0/gensim/test/test_sklearn_integration.py", line 9, in <module>
    from sklearn.pipeline import Pipeline
ImportError: No module named 'sklearn'

Versions

Linux-4.9.27-x86_64-with-glibc2.3.4
Python 3.5.3 (default, Jan 17 2017, 07:57:56)
[GCC 5.4.0]
NumPy 1.11.3
SciPy 0.18.1
gensim 2.1.0
FAST_VERSION 0

@tmylk
Copy link
Contributor

tmylk commented May 15, 2017

After this change
d3db946
pip install gensim[test] installs them.

However the tests for sklearn and varembed/mofressor shouldn't run when they are not installed, same way as WMD tests. TODO: skip tests if sklearn or morfessor not installed.

@tmylk tmylk added difficulty easy Easy issue: required small fix testing Issue related with testing (code, documentation, etc) labels May 15, 2017
@menshikh-iv
Copy link
Contributor

All fixed, now you can run pip install .[test]; python setup.py test and tests will run correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty easy Easy issue: required small fix testing Issue related with testing (code, documentation, etc)
Projects
None yet
Development

No branches or pull requests

3 participants