Skip to content

Conversation

@Greenheart
Copy link

Main changes

Describe how to create temporary directories, and how to execute the CLI test with a specific current working directory (CWD).

This expands on the basic examples and ensures the common needs for CLI app testing are covered. Hopefully, this will make testing more accessible to people reading the book.

@epage
Copy link
Contributor

epage commented Jan 19, 2026

  1. Please clean up your commits for how they should be reviewed and merged
  2. Please separate concerns to separate commits


</aside>

## Executing tests in a temporary directory
Copy link
Contributor

Choose a reason for hiding this comment

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

This is all focusing on teaching an API and is not fitting it within the narrative of the book

Copy link
Author

Choose a reason for hiding this comment

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

I will rewrite the section intro to fit better with the style of the section before and after.

For example, by connecting the newly introduced APIs to what the book has explored so far.

Copy link
Contributor

Choose a reason for hiding this comment

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

It also needs to be tied into the application we are testing

Copy link
Author

@Greenheart Greenheart Jan 19, 2026

Choose a reason for hiding this comment

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

Hi again! Please review the combined diff for this PR to see the latest version :)

1: I rewrote the section and created a new test case to describe the new concepts in a way that fits better with the rest of the book. I opted to make the test and description slightly verbose and more explicit to give a better understanding. This way, we clearly show what happens when you set the current working directory, and explain why it works in one case but not the other.

This could technically be rewritten in a shorter format, skipping the nested directory. However, then we wouldn't have such a clear visual example with a directory structure when we should explain how the current working directory works.

I think it's worth a longer description and example, because the CWD is a very important concept for CLI tools, especially when accepting paths as CLI arguments.


2: I also removed the changes that were moved to a separate PR.

@Greenheart
Copy link
Author

Greenheart commented Jan 19, 2026

Thanks for the review.

Update: I split the unrelated changes into a separate commit, and combined the main changes into a single commit.

Will think about how to get the example to fit better with the book's narrative.

@Greenheart Greenheart force-pushed the feature/add-cli-testing-with-tmp-directory-and-cwd branch 2 times, most recently from 3fe28f9 to 26b2faf Compare January 19, 2026 14:45
test with a specific current working directory (CWD).

This expands on the basic examples and ensures the common needs for CLI
app testing are covered. Hopefully, this will make testing more
accessible to people reading the book.
@Greenheart Greenheart force-pushed the feature/add-cli-testing-with-tmp-directory-and-cwd branch 3 times, most recently from d64a758 to 9c9b572 Compare January 19, 2026 23:15
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.

2 participants