yeraydiazdiaz / lunr.py

A Python implementation of Lunr.js šŸŒ–
http://lunr.readthedocs.io
MIT License
187 stars 16 forks source link

0.6.2: pytests is failing #117

Open kloczek opened 2 years ago

kloczek commented 2 years ago

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-lunr-0.6.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-lunr-0.6.2-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2, configfile: tox.ini collected 308 items tests/test_builder.py ....................... [ 7%] tests/test_complete_set.py ... [ 8%] tests/test_field_ref.py .... [ 9%] tests/test_index.py ......... [ 12%] tests/test_language_support.py ....... [ 14%] tests/test_match_data.py ........... [ 18%] tests/test_pipeline.py ............................ [ 27%] tests/test_plugins.py ... [ 28%] tests/test_query.py ............... [ 33%] tests/test_query_lexer.py .............. [ 37%] tests/test_query_parser.py ............................. [ 47%] tests/test_search.py ......................................................... [ 65%] tests/test_serialization.py . [ 66%] tests/test_stemmer.py .. [ 66%] tests/test_stop_word_filter.py ...... [ 68%] tests/test_token.py ....... [ 71%] tests/test_token_set.py .................................. [ 82%] tests/test_tokenizer.py .................. [ 87%] tests/test_trimmer.py ........ [ 90%] tests/test_vector.py ...................... [ 97%] tests/acceptance_tests/test_language_support.py FFFF [ 99%] tests/acceptance_tests/test_mkdocs.py FFF [100%] ================================================================================= FAILURES ================================================================================= __________________________________________________________ test_languages_query_results_match_javascript_results ___________________________________________________________ @pytest.mark.acceptance def test_languages_query_results_match_javascript_results(): query_string = "resistencia" > js_results = run_node_script("language_query.js", query_string).split("\n") tests/acceptance_tests/test_language_support.py:14: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/utils.py:43: in run_node_script js_output = subprocess.check_output(["node", js_path] + list(args)) /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_query.js', 'resistencia'],), kwargs = {'stdout': -1} process = , stdout = b'', stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_query.js', 'resistencia']' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'lunr' Require stack: - /home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_query.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_query.js:2:14) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_query.js' ] } __________________________________________________ test_js_serialized_lang_index_can_be_loaded_and_produces_same_results ___________________________________________________ @pytest.mark.acceptance def test_js_serialized_lang_index_can_be_loaded_and_produces_same_results(): > json_path = run_node_script("language_serialize_index.js") tests/acceptance_tests/test_language_support.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/utils.py:43: in run_node_script js_output = subprocess.check_output(["node", js_path] + list(args)) /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_serialize_index.js'],), kwargs = {'stdout': -1} process = , stdout = b'', stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_serialize_index.js']' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'tmp' Require stack: - /home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_serialize_index.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_serialize_index.js:2:13) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_serialize_index.js' ] } _________________________________________________ test_serialized_lang_index_can_be_loaded_in_js_and_produces_same_results _________________________________________________ @pytest.mark.acceptance def test_serialized_lang_index_can_be_loaded_in_js_and_produces_same_results(): data = read_json_fixture("lang_es.json") index = lunr( ref="id", fields=("title", "text"), documents=data["docs"], languages="es" ) query_string = "imperio" results = index.search(query_string) serialized_index = index.serialize() with tempfile.NamedTemporaryFile(delete=False) as fp: fp.write(json.dumps(serialized_index).encode()) > js_results = run_node_script( "language_load_serialized_index_and_search.js", fp.name, query_string ).split("\n") tests/acceptance_tests/test_language_support.py:49: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/utils.py:43: in run_node_script js_output = subprocess.check_output(["node", js_path] + list(args)) /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js', '/tmp/tmpvr_q6llt', 'imperio'],) kwargs = {'stdout': -1}, process = , stdout = b'', stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js', '/tmp/tmpvr_q6llt', 'imperio']' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- [nltk_data] Downloading package stopwords to [nltk_data] /home/tkloczko/nltk_data... [nltk_data] Package stopwords is already up-to-date! WARNING - Overwriting existing registered function stopWordFilter-es WARNING - Overwriting existing registered function lunr-multi-trimmer-es node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'lunr' Require stack: - /home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js:2:14) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js' ] } ---------------------------------------------------------------------------- Captured log call ----------------------------------------------------------------------------- WARNING lunr.pipeline:pipeline.py:36 Overwriting existing registered function stopWordFilter-es WARNING lunr.pipeline:pipeline.py:36 Overwriting existing registered function lunr-multi-trimmer-es __________________________________________________ test_serialized_multilang_index_can_be_loaded_in_js_and_results_equal ___________________________________________________ @pytest.mark.acceptance def test_serialized_multilang_index_can_be_loaded_in_js_and_results_equal(): data = read_json_fixture("lang_es_en.json") index = lunr( ref="id", fields=("title", "text"), documents=data["docs"], languages=["es", "en"], ) query_string = "taxation" results = index.search(query_string) serialized_index = index.serialize() with tempfile.NamedTemporaryFile(delete=False) as fp: fp.write(json.dumps(serialized_index).encode()) > js_results = run_node_script( "language_load_serialized_index_and_search.js", fp.name, query_string, "lang_es_en.json", ).split("\n") tests/acceptance_tests/test_language_support.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/utils.py:43: in run_node_script js_output = subprocess.check_output(["node", js_path] + list(args)) /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js', '/tmp/tmpmkb895a2', 'taxation', 'lang_es_en.json'],) kwargs = {'stdout': -1}, process = , stdout = b'', stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js', '/tmp/tmpmkb895a2', 'taxation', 'lang_es_en.json']' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- [nltk_data] Downloading package stopwords to [nltk_data] /home/tkloczko/nltk_data... [nltk_data] Package stopwords is already up-to-date! WARNING - Overwriting existing registered function stopWordFilter-es node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'lunr' Require stack: - /home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js:2:14) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/language_load_serialized_index_and_search.js' ] } ---------------------------------------------------------------------------- Captured log call ----------------------------------------------------------------------------- WARNING lunr.pipeline:pipeline.py:36 Overwriting existing registered function stopWordFilter-es ____________________________________________________________________ test_mkdocs_produces_same_results _____________________________________________________________________ @pytest.mark.acceptance def test_mkdocs_produces_same_results(): query_string = "plugins" > js_results = run_node_script("mkdocs_query.js", query_string).split("\n") tests/acceptance_tests/test_mkdocs.py:14: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/utils.py:43: in run_node_script js_output = subprocess.check_output(["node", js_path] + list(args)) /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_query.js', 'plugins'],), kwargs = {'stdout': -1} process = , stdout = b'', stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_query.js', 'plugins']' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'lunr' Require stack: - /home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_query.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_query.js:2:14) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_query.js' ] } _____________________________________________________ test_js_serialized_index_can_be_loaded_and_produces_same_results _____________________________________________________ @pytest.mark.acceptance def test_js_serialized_index_can_be_loaded_and_produces_same_results(): > json_path = run_node_script("mkdocs_serialization.js") tests/acceptance_tests/test_mkdocs.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/utils.py:43: in run_node_script js_output = subprocess.check_output(["node", js_path] + list(args)) /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_serialization.js'],), kwargs = {'stdout': -1} process = , stdout = b'', stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_serialization.js']' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'tmp' Require stack: - /home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_serialization.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_serialization.js:2:13) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_serialization.js' ] } ___________________________________________________ test_serialized_index_can_be_loaded_in_js_and_produces_same_results ____________________________________________________ @pytest.mark.acceptance def test_serialized_index_can_be_loaded_in_js_and_produces_same_results(): data = read_json_fixture("mkdocs_index.json") index = lunr(ref="id", fields=("title", "text"), documents=data["docs"]) query_string = "plugins" results = index.search(query_string) serialized_index = index.serialize() with tempfile.NamedTemporaryFile(delete=False) as fp: fp.write(json.dumps(serialized_index).encode()) > js_results = run_node_script( "mkdocs_load_serialized_index_and_search.js", fp.name, query_string ).split("\n") tests/acceptance_tests/test_mkdocs.py:45: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/utils.py:43: in run_node_script js_output = subprocess.check_output(["node", js_path] + list(args)) /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, capture_output = False, timeout = None, check = True popenargs = (['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_load_serialized_index_and_search.js', '/tmp/tmptivxzbr7', 'plugins'],) kwargs = {'stdout': -1}, process = , stdout = b'', stderr = None, retcode = 1 def run(*popenargs, input=None, capture_output=False, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass bytes or a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. By default, all communication is in bytes, and therefore any "input" should be bytes, and the stdout and stderr will be bytes. If in text mode, any "input" should be a string, and stdout and stderr will be strings decoded according to locale encoding, or by "encoding" if set. Text mode is triggered by setting any of text, encoding, errors or universal_newlines. The other arguments are the same as for the Popen constructor. """ if input is not None: if kwargs.get('stdin') is not None: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE if capture_output: if kwargs.get('stdout') is not None or kwargs.get('stderr') is not None: raise ValueError('stdout and stderr arguments may not be used ' 'with capture_output.') kwargs['stdout'] = PIPE kwargs['stderr'] = PIPE with Popen(*popenargs, **kwargs) as process: try: stdout, stderr = process.communicate(input, timeout=timeout) except TimeoutExpired as exc: process.kill() if _mswindows: # Windows accumulates the output in a single blocking # read() call run on child threads, with the timeout # being done in a join() on those threads. communicate() # _after_ kill() is required to collect that and add it # to the exception. exc.stdout, exc.stderr = process.communicate() else: # POSIX _communicate already populated the output so # far into the TimeoutExpired exception. process.wait() raise except: # Including KeyboardInterrupt, communicate handled that. process.kill() # We don't call process.wait() as .__exit__ does that for us. raise retcode = process.poll() if check and retcode: > raise CalledProcessError(retcode, process.args, output=stdout, stderr=stderr) E subprocess.CalledProcessError: Command '['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_load_serialized_index_and_search.js', '/tmp/tmptivxzbr7', 'plugins']' returned non-zero exit status 1. /usr/lib64/python3.8/subprocess.py:516: CalledProcessError --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module 'lunr' Require stack: - /home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_load_serialized_index_and_search.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_load_serialized_index_and_search.js:2:14) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/acceptance_tests/javascript/mkdocs_load_serialized_index_and_search.js' ] } ============================================================================= warnings summary ============================================================================= tests/test_token_set.py:263 /home/tkloczko/rpmbuild/BUILD/lunr.py-0.6.2/tests/test_token_set.py:263: PytestUnknownMarkWarning: Unknown pytest.mark.timeout - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.timeout(2) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/acceptance_tests/test_language_support.py::test_languages_query_results_match_javascript_results - subprocess.CalledProcessError: Command '['node', '/home/t... FAILED tests/acceptance_tests/test_language_support.py::test_js_serialized_lang_index_can_be_loaded_and_produces_same_results - subprocess.CalledProcessError: Command '[... FAILED tests/acceptance_tests/test_language_support.py::test_serialized_lang_index_can_be_loaded_in_js_and_produces_same_results - subprocess.CalledProcessError: Command... FAILED tests/acceptance_tests/test_language_support.py::test_serialized_multilang_index_can_be_loaded_in_js_and_results_equal - subprocess.CalledProcessError: Command '[... FAILED tests/acceptance_tests/test_mkdocs.py::test_mkdocs_produces_same_results - subprocess.CalledProcessError: Command '['node', '/home/tkloczko/rpmbuild/BUILD/lunr.py... FAILED tests/acceptance_tests/test_mkdocs.py::test_js_serialized_index_can_be_loaded_and_produces_same_results - subprocess.CalledProcessError: Command '['node', '/home/... FAILED tests/acceptance_tests/test_mkdocs.py::test_serialized_index_can_be_loaded_in_js_and_produces_same_results - subprocess.CalledProcessError: Command '['node', '/ho... ================================================================= 7 failed, 301 passed, 1 warning in 3.42s ================================================================= ```
yeraydiazdiaz commented 2 years ago

Hi @kloczek, as you can see the failing tests are acceptance tests which require a working NodeJS installation and running npm install on tests/acceptance_tests/javascript/ to install lunr.js before running the tests to comparing the results from lunr.py and lunr.js, would you be able to do that for packaging?

Alternatively you could explictly exclude the acceptance tests by running pytest -m "not acceptance".

kloczek commented 2 years ago

Issue is that I have installed npm in build env and I'm not aware about any issues with my nodejs. Test suite should not require final installation of tested resources because it makes suchg test suite useless in case of typical packaging procedure which I've described on top of this ticket.

FYI: temporary I've added those units to --deselect list so I have kind of solution however it woiuld be nice to have test suite which would be compliant with that typical packaging procedure šŸ˜ƒ

yeraydiazdiaz commented 2 years ago

Frankly I know very little about the "typical packaging procedure" or what are reasonable expectations for test requirements on that context.

I wrote acceptance tests to ensure full compatibility with lunr.js which is a key goal in the project, but I can imagine if you're only concerned with the Python side it would feel unnecessary. Sounds like a good way forward would be not include the acceptance tests in the wheel at all, possibly also exclude them from the source distribution, but again I don't have a lot of experience on what the common behaviour would be.

kloczek commented 2 years ago

Frankly I know very little about the "typical packaging procedure" or what are reasonable expectations for test requirements on that context.

You don't have to know that kind of details .. just please try to use what I've described as scaffold of that procedure šŸ˜›
And just in case .. I'm not expecting that such issue would be solved yesterday šŸ˜ .. I have now some adjustment in my build procedure and I know that in case of your module it is nothing more that some test suite design issue - > from my perspective that issue is not critical. Sometimes fixing such issues may be easy .. sometimes not šŸ˜ƒ Don't worry and take your time šŸ˜„

kloczek commented 2 years ago

gentle ping .. šŸ˜‹

yeraydiazdiaz commented 2 years ago

Hi @kloczek, I looked into this issue but I'm not clear on why your process is attempting to run the acceptance tests. Hopefully you can provide some information.

First off, lunr.py is not PEP 517 compatible, it uses setuptools, however build manages to create a wheel for lunr.py anyway, here's the output I get:

āÆ python3 -sBm build -w --no-isolation
* Getting dependencies for wheel...
running egg_info
writing lunr.egg-info/PKG-INFO
writing dependency_links to lunr.egg-info/dependency_links.txt
writing requirements to lunr.egg-info/requires.txt
writing top-level names to lunr.egg-info/top_level.txt
reading manifest file 'lunr.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
adding license file 'LICENSE'
writing manifest file 'lunr.egg-info/SOURCES.txt'
* Building wheel...
running bdist_wheel
running build
running build_py
running egg_info
writing lunr.egg-info/PKG-INFO
writing dependency_links to lunr.egg-info/dependency_links.txt
writing requirements to lunr.egg-info/requires.txt
writing top-level names to lunr.egg-info/top_level.txt
reading manifest file 'lunr.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
adding license file 'LICENSE'
writing manifest file 'lunr.egg-info/SOURCES.txt'
installing to build/bdist.macosx-12.4-arm64/wheel
running install
running install_lib
creating build/bdist.macosx-12.4-arm64/wheel
creating build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/query_parser.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/vector.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/field_ref.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/token.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/match_data.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/query.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/index.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/token_set.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/trimmer.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/__init__.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/idf.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
creating build/bdist.macosx-12.4-arm64/wheel/lunr/languages
copying build/lib/lunr/languages/trimmer.py -> build/bdist.macosx-12.4-arm64/wheel/lunr/languages
copying build/lib/lunr/languages/__init__.py -> build/bdist.macosx-12.4-arm64/wheel/lunr/languages
copying build/lib/lunr/languages/stemmer.py -> build/bdist.macosx-12.4-arm64/wheel/lunr/languages
copying build/lib/lunr/builder.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/tokenizer.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/token_set_builder.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/utils.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/pipeline.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/stop_word_filter.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/stemmer.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/exceptions.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/query_lexer.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
copying build/lib/lunr/__main__.py -> build/bdist.macosx-12.4-arm64/wheel/lunr
running install_egg_info
Copying lunr.egg-info to build/bdist.macosx-12.4-arm64/wheel/lunr-0.6.2-py3.10.egg-info
running install_scripts
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
creating build/bdist.macosx-12.4-arm64/wheel/lunr-0.6.2.dist-info/WHEEL
creating '/Users/yeraydiazdiaz/code/personal/lunr.py/dist/tmp53p_zlj4/lunr-0.6.2-py2.py3-none-any.whl' and adding 'build/bdist.macosx-12.4-arm64/wheel' to it
adding 'lunr/__init__.py'
adding 'lunr/__main__.py'
adding 'lunr/builder.py'
adding 'lunr/exceptions.py'
adding 'lunr/field_ref.py'
adding 'lunr/idf.py'
adding 'lunr/index.py'
adding 'lunr/match_data.py'
adding 'lunr/pipeline.py'
adding 'lunr/query.py'
adding 'lunr/query_lexer.py'
adding 'lunr/query_parser.py'
adding 'lunr/stemmer.py'
adding 'lunr/stop_word_filter.py'
adding 'lunr/token.py'
adding 'lunr/token_set.py'
adding 'lunr/token_set_builder.py'
adding 'lunr/tokenizer.py'
adding 'lunr/trimmer.py'
adding 'lunr/utils.py'
adding 'lunr/vector.py'
adding 'lunr/languages/__init__.py'
adding 'lunr/languages/stemmer.py'
adding 'lunr/languages/trimmer.py'
adding 'lunr-0.6.2.dist-info/LICENSE'
adding 'lunr-0.6.2.dist-info/METADATA'
adding 'lunr-0.6.2.dist-info/WHEEL'
adding 'lunr-0.6.2.dist-info/top_level.txt'
adding 'lunr-0.6.2.dist-info/RECORD'
removing build/bdist.macosx-12.4-arm64/wheel
Successfully built lunr-0.6.2-py2.py3-none-any.whl

As you can see it adds a series of files but note the tests (acceptance or otherwise) are not included. You mention your process is to install the resulting wheel and run the tests, so I assume the tests are collected from the cloned repo, is that correct?

Also, you keep mentioning a "typical packaging procedure" in your comments, do you have more information about this procedure?

kloczek commented 2 years ago

First off, lunr.py is not PEP 517 compatible, it uses setuptools, however build manages to create a wheel for lunr.py anyway, here's the output I get:

This issue ticket has nothing to do with build stage. It manages to buiod because setuptools is default pep617 build backend so in simplest possible cases it does not need any special adaptations.

This ticket is about pytest based test suite issue. Please focus on pytest.

Also, you keep mentioning a "typical packaging procedure" in your comments, do you have more information about this procedure?

Because that procedure it is now widely used by at least few distributions (not only mine) however in mine I'm using pep517 based buid in case 100% of all packaged pytjon modules (almost 1k packaged modules).

yeraydiazdiaz commented 2 years ago

This ticket is about pytest based test suite issue. Please focus on pytest.

Ok, I simply wanted to understand your process.

You haven't answered my question but assuming you are simply running pytest from the cloned repo, pytest will collect all tests, including acceptance tests.

Coming back to your description of the problem:

Issue is that I have installed npm in build env and I'm not aware about any issues with my nodejs.

As I mentioned before, in order for acceptance tests to pass you must run npm install on tests/acceptance_tests/javascript/. Presumably you cannot or will not do this as it deviates from your current procedure, if that's the case I don't mind changing the behaviour of running pytest to not run acceptance tests. Would that work for you?

kloczek commented 2 years ago

You haven't answered my question but assuming you are simply running pytest from the cloned repo, pytest will collect all tests, including acceptance tests.

No I'm using tar ball autogenerated from git tag. From my spec file

VCS:            https://github.com/yeraydiazdiaz/lunr.py/
Source0:        %{VCS}/archive/%{version}/%{name}-%{version}.tar.gz

As I mentioned before, in order for acceptance tests to pass you must run npm install on tests/acceptance_tests/javascript/.

IIRC pytest can execute some code before it wil lstart collecting units.

kloczek commented 11 months ago

You haven't answered my question but assuming you are simply running pytest from the cloned repo, pytest will collect all tests, including acceptance tests.

As I wrote opening the ticket:

Part from rpm package build log:

+ cd lunr.py-0.7.0.post1
+ /usr/bin/python3 -sBm installer dist/lunr-0.7.0.post1-py3-none-any.whl --destdir /home/tkloczko/rpmbuild/BUILDROOT/python-lunr-0.7.0.post1-2.fc35.x86_64

As I mentioned before, in order for acceptance tests to pass you must run npm install on tests/acceptance_tests/javascript/. Presumably you cannot or will not do this as it deviates from your current procedure, if that's the case I don't mind changing the behaviour of running pytest to not run acceptance tests. Would that work for you?

I'm not familiar with node. May I as for some hints how can I download necessary node components? šŸ¤”