Open kloczek opened 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"
.
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 š
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.
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 š
gentle ping .. š
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?
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).
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?
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.
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? š¤
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.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesHere is pytest output: