nedbat / scriv

Changelog management tool
https://scriv.readthedocs.io
Apache License 2.0
256 stars 28 forks source link

Unit tests fail on Windows #15

Closed kurtmckee closed 3 years ago

kurtmckee commented 3 years ago

I've checked out scriv from master on Windows and ran the following commands:

python -m virtualenv venv
.\venv\Scripts\Activate.ps1
python -m pip install pip --upgrade
python -m pip install -r .\requirements\dev.txt
tox

Almost every tox environment failed. There appear to be multiple issues:

  1. os.sep is not respected. Tests for output relied on hard-coded paths like call(['git', 'add', 'changelog.d/20130225_151617_joedev.rst']), but failed because Windows used backslashes in the command.

  2. Black attempted to reformat every file in the virtual environment, which took a very long time to fail. Errors like error: cannot format venv\Lib\site-packages\docutils\languages\fa.py: I/O operation on closed file appeared for what appears to be every file in the virtual environment. Until I fix this it may be difficult to zero in on the other issues due to sheer volume of output.

  3. make is not available in my environment. This may be insurmountable in a Windows environment but I'll see if I can at least trace this.

I'll work to resolve both of these issue and submit a patch.

kurtmckee commented 3 years ago

MyPy is really upset when I reference os.sep or os.path.sep. It says the attribute doesn't exist. I'm going to wrap everything in a getattr(os.path, "sep", ""), but to prevent additional line length errors I'm putting everything into a "".join() call.

When I submit the patch please let me know if my complaint-avoidance solutions are acceptable.

kurtmckee commented 3 years ago

I'm also getting pylint errors saying "Optional is unsubscriptable". It appears that pylint has a fix coming but it isn't live yet. I'll recreate my environment using Python 3.8 for now.

nedbat commented 3 years ago

Thanks for getting Windows going! I'm trying to switch over to GitHub Actions in #17, and while some things are failing, some Windows tests are passing. Can you help me understand why yours fail but mine succeed, and how to make my GitHub Actions Windows tests more accurate for your environment?

The pylint failures happen on 3.9, but not 3.8 I think. Don't worry about those, I will track them down :)

kurtmckee commented 3 years ago

Sure thing! I'll look at the results in #17 now.