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

Rename info.py.in to info.py #1141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ArimaBatista
Copy link
Contributor

File naming error resulting in test failures

File naming error resulting in test failures
@ArimaBatista
Copy link
Contributor Author

This causes the error 'GTG/core/meson.build:25:10: ERROR: File info.py.in does not exist'. To fix this, change 'info.py.in' to 'info.py' on line 26 of that file. After this change, 'bash launch.sh' will work with automated tests and 'precommit'.

@ArimaBatista ArimaBatista reopened this Sep 20, 2024
ArimaBatista added a commit to ArimaBatista/gtg that referenced this pull request Sep 20, 2024
As a follow-up to issue getting-things-gnome#1141, we've successfully renamed info.py.in to info.py. This change has resolved the automated test failures we were experiencing.
@Neui
Copy link
Contributor

Neui commented Sep 21, 2024

.in files are to be post-processed (usually by the build system). In this case, it is for the version (replacing @VCS_TAG@ with the version).

I don't like this solution because it removes the indication that it is a file to be post-processed. If anything, tests should just work with the build-installed version since we don't support running the project in-place anyway (which sound what you are trying to do), unless we (or someone else) make the project runnable in-place.

PR #1142 depends on this commit, so you should just combine both into one PR (you could add the commit to this repo, but it seems you are editing from the Github Web UI (because of the branch name) and I am not sure if it can do that.)

@SqAtx
Copy link
Contributor

SqAtx commented Sep 21, 2024

Yes, that's not actually a file naming error. The problem is that meson needs to be run before running the tests. That will create process the .py.in file in the output folder, and you can then run the tests there. But that's not documented except in the comments of #1036:

The file info.py.in is a template that gets filled (also called configured) by the meson setup step.
The resulting file is placed into the build directory.
This is the file we actually want Python to find and use.

It's kind of annoying to have to do that. It gets in the way of quick iteration when writing code and tests in parallel. So on my local machine, after running meson once, I copied the resulting info.py into GTG/core. Now I can run the tests normally:

~/src/gtg$ pytest
==================================================================== test session starts =====================================================================
platform linux -- Python 3.12.3, pytest-8.2.2, pluggy-1.5.0
rootdir: /home/kevin/src/gtg
configfile: pyproject.toml
testpaths: tests
collected 160 items                                                                                                                                          

tests/backend/backend_caldav_test.py sssssss                                                                                                           [  4%]
tests/core/test_config.py ...................                                                                                                          [ 16%]
[...]

=============================================================== 153 passed, 7 skipped in 1.20s ===============================================================

This is probably worth a subsection under "Setting up a development environment" in the README. I'll look into that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants