Skip to content

Commit

Permalink
add a fix-unittests make target to fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jul 30, 2023
1 parent 49aba75 commit 1336977
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ PY3_DEPS = \
requests \
setuptools \
sphinx_rtd_theme \
teyit \
twine \
virtualenv \
wheel
Expand Down Expand Up @@ -225,9 +226,13 @@ fix-flake8: ## Run autopep8, fix some Python flake8 / pep8 issues.
fix-imports: ## Fix imports with isort.
@git ls-files '*.py' | xargs $(PYTHON) -m isort --jobs=${NUM_WORKERS}

fix-unittests: ## Fix unittest idioms.
@git ls-files '*test_*.py' | xargs $(PYTHON) -m teyit --show-stats

fix-all: ## Run all code fixers.
${MAKE} fix-flake8
${MAKE} fix-imports
${MAKE} fix-unittests

# ===================================================================
# GIT
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def test_os_constants(self):

# assert all other constants are set to False
for name in names:
self.assertIs(getattr(psutil, name), False, msg=name)
self.assertFalse(getattr(psutil, name), msg=name)


class TestMemoryAPIs(PsutilTestCase):
Expand Down
4 changes: 2 additions & 2 deletions psutil/tests/test_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,15 @@ def test_special_pid(self):
# that nothing strange happens
str(p)
p.username()
self.assertTrue(p.create_time() >= 0.0)
self.assertGreaterEqual(p.create_time(), 0.0)
try:
rss, vms = p.memory_info()[:2]
except psutil.AccessDenied:
# expected on Windows Vista and Windows 7
if not platform.uname()[1] in ('vista', 'win-7', 'win7'):
raise
else:
self.assertTrue(rss > 0)
self.assertGreater(rss, 0)

def test_send_signal(self):
p = psutil.Process(self.pid)
Expand Down

0 comments on commit 1336977

Please sign in to comment.