ApprovalTests.Python icon indicating copy to clipboard operation
ApprovalTests.Python copied to clipboard

tests/integrations/pytest/test_namer.py fails if cloned to a different directory name

Open JayBazuzi opened this issue 1 year ago • 3 comments

To Reproduce:

git clone https://github.com/approvals/ApprovalTests.Python foo
cd foo
./run_tests.sh

Result:

test_received_filename fails

JayBazuzi avatar Nov 04 '24 01:11 JayBazuzi

Yup. Fails for me, too.

Even after I s/python/python3/ in ./run_tests.sh.

MichaelRWolf avatar Nov 04 '24 03:11 MichaelRWolf

The problem is here: https://github.com/approvals/ApprovalTests.Python/blob/main/tests/integrations/pytest/test_namer.py#L14 (and a few lines down) which hard-code the name of the directory.

JayBazuzi avatar Nov 04 '24 03:11 JayBazuzi

If it helps... git rev-parse --show-toplevel returns the absolute path of the project root, either

  • /Users/michael/repos/ApprovalTests.Python or
  • /Users/michael/repos/foo

That could be used in various ways with dirname, basename to pass relative paths.

MichaelRWolf avatar Nov 04 '24 15:11 MichaelRWolf