Skip to content

Commit

Permalink
Enable test_word2vec_stand_alone_script by using sys.executable for p…
Browse files Browse the repository at this point in the history
…ython
  • Loading branch information
pabs3 committed Feb 26, 2022
1 parent 86b1832 commit 8cb676f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions gensim/test/test_word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import bz2
import sys
import tempfile
import subprocess

import numpy as np

Expand Down Expand Up @@ -1162,15 +1163,15 @@ def test_path_line_sentences_one_file(self):

# endclass TestWord2VecSentenceIterators

# TODO: get correct path to Python binary
# class TestWord2VecScripts(unittest.TestCase):
# def test_word2vec_stand_alone_script(self):
# """Does Word2Vec script launch standalone?"""
# cmd = 'python -m gensim.scripts.word2vec_standalone -train ' + datapath('testcorpus.txt') + \
# ' -output vec.txt -size 200 -sample 1e-4 -binary 0 -iter 3 -min_count 1'
# output = check_output(cmd, stderr=PIPE)
# self.assertEqual(output, '0')
# #endclass TestWord2VecScripts
class TestWord2VecScripts(unittest.TestCase):
def test_word2vec_stand_alone_script(self):
"""Does Word2Vec script launch standalone?"""
cmd = [sys.executable, '-m', 'gensim.scripts.word2vec_standalone', '-train', datapath('testcorpus.txt')] + \
'-output vec.txt -size 200 -sample 1e-4 -binary 0 -iter 3 -min_count 1'.split()
output = check_output(args=cmd, stderr=subprocess.PIPE)
self.assertEqual(output, '0')

#endclass TestWord2VecScripts


if not hasattr(TestWord2VecModel, 'assertLess'):
Expand Down

0 comments on commit 8cb676f

Please sign in to comment.