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

Add mocks for unit tests #1294

Merged
merged 1 commit into from
Oct 18, 2022
Merged

Add mocks for unit tests #1294

merged 1 commit into from
Oct 18, 2022

Conversation

gsingh93
Copy link
Member

No description provided.

@codecov-commenter
Copy link

Codecov Report

Merging #1294 (95f4478) into dev (dac5340) will decrease coverage by 0.04%.
The diff coverage is 92.30%.

@@            Coverage Diff             @@
##              dev    #1294      +/-   ##
==========================================
- Coverage   57.19%   57.14%   -0.05%     
==========================================
  Files         188      188              
  Lines       20716    20707       -9     
  Branches     1916     1917       +1     
==========================================
- Hits        11849    11834      -15     
- Misses       8400     8409       +9     
+ Partials      467      464       -3     
Impacted Files Coverage Δ
pwndbg/commands/__init__.py 67.59% <ø> (-2.24%) ⬇️
pwndbg/__init__.py 87.50% <88.88%> (-3.41%) ⬇️
pwndbg/color/theme.py 100.00% <100.00%> (ø)
pwndbg/exception.py 55.55% <100.00%> (ø)
pwndbg/gdblib/argv.py 88.23% <100.00%> (ø)
pwndbg/ui.py 75.00% <100.00%> (ø)
pwndbg/commands/vmmap.py 41.30% <0.00%> (-2.18%) ⬇️
pwndbg/ida.py 62.19% <0.00%> (-0.61%) ⬇️
tests/test_mprotect.py 100.00% <0.00%> (ø)
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@gsingh93 gsingh93 marked this pull request as ready for review October 18, 2022 06:31

class GdbLib(types.ModuleType):
def __init__(self, module_name):
super(GdbLib, self).__init__(module_name)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
super(GdbLib, self).__init__(module_name)
super().__init__(module_name)

Copy link
Member

@disconnect3d disconnect3d left a comment

Choose a reason for hiding this comment

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

lgtm; one note: maybe we should move unit-tests to tests/?

@gsingh93
Copy link
Member Author

lgtm; one note: maybe we should move unit-tests to tests/?

I was thinking of we should move the content of tests to tests/gdb-tests and have the unit tests be in tests/unit-tests. We can't have unit-tests in tests without moving the existing tests to some other folder, as conftest.py gets imported, which we don't want for unit-tests. If this directory structure sounds good, I'll update this PR with it.

@disconnect3d
Copy link
Member

Sounds good to me. Btw we can have multiple conftest.py files afaik

@@ -0,0 +1,36 @@
import sys
import types
from unittest.mock import MagicMock
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think mixing unittest and pytest will be okay?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, pytest is designed to work well with unittest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants