Skip to content

Add gitignore#2231

Open
FabianA2001 wants to merge 3 commits intopypa:masterfrom
FabianA2001:add-gitignore
Open

Add gitignore#2231
FabianA2001 wants to merge 3 commits intopypa:masterfrom
FabianA2001:add-gitignore

Conversation

@FabianA2001
Copy link
Copy Markdown

Add .gitignore to hatch new for issue #2229 and update the test.

Skiptests/backend/builders/test_sdist.py::TestBuildStandard::test_default_vcs_git_exclusion_files because the test conflicts with new .gitignore.

assert stat.st_mtime == get_reproducible_timestamp()

# TODO: update test
@pytest.mark.skip(reason="Issues with the new feature, and it's not clear how the test needs to be updated")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not mark tests to skip. If this test is failing then there is a regression that needs to be looked at.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that the test creates a .gitignore file, which is then overwritten by the new .gitignore file. I don't know how to modify the test, and I can't find any information about the test.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I still don't understand what the test is supposed to test.

Currently, a .gitignore file is created outside the project, which is then included in the project by the builder.

With the new feature, an additional .gitignore file with different content is now created within the project. As a result, the builder no longer considers the external .gitignore file, and the *.h and *.so files are no longer ignored after building.

How can I modify the test so that it still fulfills the original purpose?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a gitignore created in that template file I sent, so you need to remove the gitignore creation from there if you have hatch new now creating one because that template calls hatch new to create a project.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you sent me is used to generate the expected_files. But if I just expect the new .gitignore there instead of the old one, a different error is thrown because lib.h is now recognized.

Another problem is that the new .gitignore is created in a different location.

=== Content of temp_dir ===
  .gitignore_creation_in_test
  my-app/
  my-app/.gitignore
  my-app/LICENSE.txt
  my-app/README.md
  my-app/my_app/
  my-app/my_app/__about__.py
  my-app/my_app/__init__.py
  my-app/my_app/lib.h
  my-app/my_app/lib.so
  my-app/pyproject.toml
  my-app/tests/
  my-app/tests/__init__.py

It’s also not enough to just add *.h to the new .gitignore and delete the old one because then the builder adds other files.

I wrote another commit where the test works, but I’m not sure if that’s still the idea behind the original test.

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.

2 participants