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

allow setting HistoryManager.hist_file with config #940

Merged
merged 2 commits into from Oct 30, 2011

Conversation

minrk
Copy link
Member

@minrk minrk commented Oct 29, 2011

fixes trait init in HistoryAccessor, which prevented setting hist_file via config from having any effect.

Also remove dependency on having a shell object in HistoryAccessor.__init__

Associated test included.

as described in #882

fixes improper init in HistoryAccessor, preventing setting `hist_file` via config from having any effect.

Also remove dependency on having a shell object in `HistoryAccessor.__init__`

Associated test included.

def test_hist_file_config():
cfg = Config()
cfg.HistoryManager.hist_file = tempfile.mktemp()
Copy link
Member

Choose a reason for hiding this comment

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

mktemp is deprecated. For this particular test, I suggest instead creating the temp file with NamedTemporaryFile:

tfile = tempfile.NamedTemporaryFile(delete=False)
cfg.HistoryManager.hist_file = tfile.name
...

try:
  nt.assert...
finally:
  os.unlink(tfile.name)

That's the right pattern for these guys. In Pyhton 3 they've been turned into context managers, which is really what you want.

@fperez
Copy link
Member

fperez commented Oct 29, 2011

Other than the above fixes to the test, the code looks good to me. I'll merge it once this small stuff is fixed; thanks!

@minrk
Copy link
Member Author

minrk commented Oct 30, 2011

suggested changes made and pushed

fperez added a commit that referenced this pull request Oct 30, 2011
Allow setting HistoryManager.hist_file with config.  This fixes trait init in HistoryAccessor, which prevented setting hist_file via config from having any effect.
@fperez fperez merged commit 602e3c3 into ipython:master Oct 30, 2011
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Allow setting HistoryManager.hist_file with config.  This fixes trait init in HistoryAccessor, which prevented setting hist_file via config from having any effect.
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.

None yet

2 participants