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

conftest: set HISTFILE=/dev/null in order not to affect user's history #525

Merged
merged 3 commits into from
May 21, 2021

Conversation

akinomyoga
Copy link
Collaborator

@akinomyoga akinomyoga commented May 21, 2021

After running make check or cd test/t; pytest-3 ..., my command histories in ~/.bash_history were washed out. I believe we should set HISTFILE=/dev/null in conftest.py not to affect the users's history.

This time I didn't add the test for this behavior. If you think we need to add tests for tests, please let me know.

Edit: Resolve #321

@akinomyoga
Copy link
Collaborator Author

akinomyoga commented May 21, 2021

Now I found an existing issue #321

I vaguely remember that others preferred that a long time ago. But I've always found it very annoying, just haven't got around to it especially now that probably most of my tests are run in dedicated containers. But a clean fix would be very welcome nevertheless. (comment by @scop #321)

I'm not sure what was the purpose of the "others", but if one needs some information on what commands are executed while the tests, how about instead set HISTFILE=./conftest.log so that the commands will be appended to test/fixtures/conftest.log (with conftest.log being added to .gitignore? Of course, we may instead output them in another file outside the git tree, but I'm not sure which place is appropriate for now.

@scop scop merged commit 5815238 into scop:master May 21, 2021
@scop
Copy link
Owner

scop commented May 21, 2021

Thanks!

@akinomyoga
Copy link
Collaborator Author

Thank you for taking your time to review the PR and fix my English!

@akinomyoga akinomyoga deleted the set-HISTFILE-in-test branch May 21, 2021 06:17
@scop
Copy link
Owner

scop commented May 21, 2021

Forgot to note that I opted to not do anything about a history file of our own for now, let's revisit if there's a case where we'd need that. Loads of output (maybe even too much) can already be obtained by using $BASHCOMP_TEST_LOGFILE.

@akinomyoga
Copy link
Collaborator Author

akinomyoga commented May 21, 2021

OK, thank you for the information.

By the way, as for #492, I'm now trying to understand what @pytest.mark.complete does. It seems @pytest.mark.complete cannot be directly used for the present purpose, but maybe I should add another decorator that allows changing the directory and shell settings. I think it takes some time.

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.

Tests clutter user's bash history
2 participants