Skip to content

Added unit tests for persistent history file #468

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

Merged
merged 2 commits into from
Jul 12, 2018
Merged

Added unit tests for persistent history file #468

merged 2 commits into from
Jul 12, 2018

Conversation

kmvanbrunt
Copy link
Member

No description provided.

@kmvanbrunt kmvanbrunt requested a review from tleonhardt as a code owner July 12, 2018 07:43
@codecov
Copy link

codecov bot commented Jul 12, 2018

Codecov Report

Merging #468 into master will increase coverage by 0.65%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #468      +/-   ##
=========================================
+ Coverage   89.84%   90.5%   +0.65%     
=========================================
  Files          10      10              
  Lines        2758    2758              
=========================================
+ Hits         2478    2496      +18     
+ Misses        280     262      -18
Impacted Files Coverage Δ
cmd2/cmd2.py 91.02% <0%> (+1.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d2133a...87ab9c8. Read the comment docs.

@tleonhardt tleonhardt added this to the 0.9.3 milestone Jul 12, 2018
@tleonhardt tleonhardt self-assigned this Jul 12, 2018
…ent history file

Also:
- Switched to writing the file in the temp directory

# Create path to a history file
test_dir = os.path.dirname(request.module.__file__)
hist_file = os.path.join(test_dir, 'hist_file')
Copy link
Member

Choose a reason for hiding this comment

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

At least on my system, either this or the next test exit with the file tests/hist_file still there.

@@ -1825,3 +1825,74 @@ def test_onecmd_raw_str_quit(base_app):
assert stop
assert out == ''


@pytest.fixture(scope="session")
Copy link
Member

Choose a reason for hiding this comment

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

I added this fixture to help ensure that the history file always gets deleted no matter what

except FileNotFoundError:
pass

def test_existing_history_file(hist_file, capsys):
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for adding some unit tests of this feature!

@tleonhardt tleonhardt merged commit 4fbe263 into master Jul 12, 2018
@tleonhardt tleonhardt deleted the hist_tests branch July 12, 2018 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants