Skip to content

Fixed: Auto Discovery of .test files Fixes #8650 #11445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

SwagatSBhuyan
Copy link

Fixed: issue #8650

On merging this PR, the testcheck.py script will automatically walk the test file directory and record all the test files starting with 'check-'. This is very crucial in order for this problem to not emerge in future endeavors when new test files are added into the repository, as the file searching is automated to detect any new such files.
This approach is not using regex, rather uses simple python os library methods.

The changes have been verified on my local system, the py script after changes runs smoothly. The newly detected test files are shown in this helper local python script terminal:

1

It would be great if this PR is authorized, I could henceforth start my journey to contributing to mypy after this.

Thanks @JukkaL @ethanhs @davidzwa

'check-slots.test',
'check-formatting.test'
]
test_path = '../../test-data/unit/'
Copy link
Member

Choose a reason for hiding this comment

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

This won't work on windows. Use os.path / pathlib

Copy link
Contributor

Choose a reason for hiding this comment

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

Surprisingly enough, using forward slashes doesn't break this on Windows. Windows supports using forward slashes in file paths in most cases (There are some edge cases where only backslashes are allowed in file paths, but this doesn't seem to be one of those situations).

That being said, using pathlib is probably a good idea for this considering that it's probably more portable than just using forward slashes and because it would probably make it easier to make this path relative to the current file's path (which I believe is necessary to fix the CI failures).

'check-formatting.test'
]
test_path = '../../test-data/unit/'
typecheck_files = [f for f in listdir(test_path) if isfile(join(test_path, f)) and f.startswith('check-')]
Copy link
Member

@sobolevn sobolevn Nov 3, 2021

Choose a reason for hiding this comment

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

listdir won't recurse into nested folders if we ever have one.

Copy link
Author

Choose a reason for hiding this comment

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

ok, so I also need to check for test files in deeper repositories as well right? I'll get on it, soon.

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.

3 participants