Skip to content
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

Fixed Spacing in Path Bug on Windows #41

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

TitusSmith33
Copy link

Pull Request

Contributors: Titus Smith

This PR is aimed at fixing Issue #36, which causes a stack trace on Windows 11 when running execexam if a space exists anywhere in the directory path.

This PR simply changes 1 line that is passed in main.py of execexam when the path to a failing check is passed. Symbax previously handled paths separately if there was a space anywhere in the directory. For example, if you had the following path:
user/documents/software engineering/exam_solution the program was splitting the path and trying to handle them one at a time rather than as one. This PR makes sure the failing path is quoted properly so that paths are handled as one, regardless of whether a space exists.

This PR should not affect code coverage.

This PR was created and tested on a Windows 11 OS. I have tested this new implementation with a space in my path, and with no spaces in my path, and they both pass without causing a stack trace anymore.

Below is line 288 of main.py, which is where I changed how paths are handled:

command = f'symbex {test_name}" -f "{failing_test_path}"'

@gkapfham
Copy link
Collaborator

Hello @TitusSmith33 can you please move this PR forward through the review process? We need to get a review from one student technical leader and from two students who did not work on the fix. Thanks, I appreciate your contribution and your work in moving this PR through the process.

@Chezka109 Chezka109 self-requested a review October 31, 2024 15:42
Copy link
Collaborator

@Chezka109 Chezka109 left a comment

Choose a reason for hiding this comment

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

Tested it out on MacOS and it's all good! I added a space in a solution repo and did not get a stack trace.

@gkapfham gkapfham added the bug Something isn't working label Oct 31, 2024
@hannahb09 hannahb09 self-requested a review October 31, 2024 18:48
Copy link
Collaborator

@hannahb09 hannahb09 left a comment

Choose a reason for hiding this comment

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

I got it to run on linux. I added a space and there was no error for it.

@AlishChhetri AlishChhetri self-requested a review October 31, 2024 18:52
Copy link
Collaborator

@AlishChhetri AlishChhetri left a comment

Choose a reason for hiding this comment

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

LGTM!

execexam/main.py Outdated
@@ -285,7 +285,7 @@ def run( # noqa: PLR0913, PLR0915
# build the command for running symbex; this tool can
# perform static analysis of Python source code and
# extract the code of a function inside of a file
command = f"symbex {test_name} -f {failing_test_path}"
command = f'symbex {test_name}" -f "{failing_test_path}"'
Copy link
Collaborator

Choose a reason for hiding this comment

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

There’s a minor syntax issue in the command string. It appears that a double quote is missing at the beginning of {test_name}. The corrected line should be:

command = f'symbex "{test_name}" -f "{failing_test_path}"'

Copy link
Collaborator

@PCain02 PCain02 left a comment

Choose a reason for hiding this comment

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

It worked for me on Windows 10! LGTM

@gkapfham
Copy link
Collaborator

Hello @TitusSmith33 will you need to update your pyproject.toml file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants