AstuteSource / chasten

:dizzy: Chasten Uses XML and XPATH to Check a Python Program's AST for Specified Patterns!
https://pypi.org/project/chasten/
GNU General Public License v2.0
7 stars 8 forks source link

Use `Path` infix operator `/` in unit tests #58

Closed simojo closed 11 months ago

simojo commented 1 year ago

Describe the bug

After a simple regex search, the I discovered the following tests assume a POSIX operating system in file paths are written:

test_constants.py
47:        fs.Current_Directory = "/new/path"

test_main.py
94:    configuration_directory = test_one + "/.chasten"
125:    configuration_directory = str(cwd) + "/.chasten"
147:    configuration_directory = str(cwd) + "/.chasten"
300:    configuration_directory = str(cwd) + "/.chasten"

test_filesystem.py
15:    directory_str = "./tests/"
23:    directory_str = "./testsNOT/"
31:    file_str = "./tests/test_filesystem.py"
39:    file_str = "./tests/test_filesystemNOT.py"

This should be fixed to merge paths using Pathlib. Ultimately this could hinder teammate's progress with developing on a windows machine, for example.

Example fix

test_constants.py
+ from pathlib import Path
...
- 47:        fs.Current_Directory = "/new/path"
+ 47:        fs.Current_Directory = str(Path("/new") / Path("path"))
Poiuy7312 commented 11 months ago

This seems to have already been solved but wasn't ever closed