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

Flexible working directory #31

Open
wants to merge 72 commits into
base: develop
Choose a base branch
from
Open

Flexible working directory #31

wants to merge 72 commits into from

Conversation

Fan-Feng
Copy link
Collaborator

This PR adds the functionality of being able to specify the working directory of the current workflow, to allow users to run workflow anywhere on either a Linux or Windows system.

# change the working directory if it exists
if os.path.exists(self.workflow_dict["working_dir"]):
os.chdir(self.workflow_dict["working_dir"])
logging.info("Change current working path to the specified path.")
Copy link
Collaborator Author

@Fan-Feng Fan-Feng May 31, 2024

Choose a reason for hiding this comment

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

I have added this part to create a new directory if it doesn't exist

)

def test_dir_simple(self):
"""This test checks when a simple working directory without any "\\" or "/" is provided and it also points to the correct path,
Copy link
Collaborator Author

@Fan-Feng Fan-Feng May 31, 2024

Choose a reason for hiding this comment

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

Added this unittest for paths without "\\" or "/"

"INFO:root:Change current working path to the specified path.",
)

def test_dir_not_exist(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add this test for path that doesn't exist

"INFO:root:Change current working path to the specified path.",
)

def test_valid_absolute_dir(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add this test for absolute path

@leijerry888
Copy link
Collaborator

Hi @Fan-Feng , could you please let me know when do you expect this PR to be ready for another review?

@Fan-Feng
Copy link
Collaborator Author

Hi @Fan-Feng , could you please let me know when do you expect this PR to be ready for another review?

Hi, Jerry, I am swamped with the residential analysis tasks these weeks, and I can make some progress next week.
Best,


self.assertEqual(
logobs.output[1],
"INFO:root:working directory specified does not exist and create a new director.",
)

def test_dir_without_seperator(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added a unit test for working directories without any "/" or "\"

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