gitignore_parser icon indicating copy to clipboard operation
gitignore_parser copied to clipboard

Add Windows CI Runners

Open Javagedes opened this issue 2 years ago • 0 comments

With recent changes to start using Path, gitignore_parser lost some support for Windows which was not caught due to CI not running on a windows runner. Also, I added python 3.12 testing

Issues with using Path which broke windows support:

  1. Path strips some trailing characters. Currently caught are ' ' and '.'
  2. Path switches path separators to the current os's path separator, breaking the regex is some instances.

Broken CI when turning on Windows Runners, before applying fixes:

  1. test_ignore_directory, specifically /home/michael/.venv/folder as Path turns it into .venv\\folder and current regex fails
  2. test_trailingspaces, as all the spaces are stripped on windows
  3. test_wildcard, specifically /home/michael/hello. as Path strips the '.' on Windows

Other Miscellaneous issue:

test_symlink_to_another_directory failed on windows - but was a test issue, not an issue with the gitignore_parser. The issue is that TemproaryDirectory() itself uses a symlink on windows, so the base_dir does not match due to the fact that in one instance its the symlink and the other is the full path. I just resolve the symlink on the project_dir and another_dir, and focus on the symlink resolution the test truly cares about.

I also added logic to automatically skip the test if the symlink fails. This happens locally if not running as an admin as you don't have permission to create symlinks.

This PR fixes the following:

  1. preserve symbols that are stripped by path: ' ' and '.'
  2. Convert rel_path to posix form with as_posix() rather than to the current OS's form with str

Closes #60

Javagedes avatar Oct 25 '23 16:10 Javagedes