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

Use pytest, get rid of test/runner.py #2447

Merged
merged 80 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
56efb1d
get rid of TSCRIPT
giampaolo Jun 21, 2024
d92b4eb
remove runner.py
giampaolo Jun 21, 2024
c3c5b09
get rid of runner invocation from individual test files
giampaolo Jun 21, 2024
1ac4efa
use pytest in the Makefile
giampaolo Jun 21, 2024
49cf6bd
fix test
giampaolo Jun 21, 2024
20f587d
adjust test
giampaolo Jun 22, 2024
8a3f121
pytest parallel
giampaolo Jun 22, 2024
7049227
expose PYTEST_PARALLEL test constant
giampaolo Jun 22, 2024
66de919
skip test in parallel mode
giampaolo Jun 22, 2024
58d4243
rm @serialrun deco
giampaolo Jun 22, 2024
9a27542
small var rename
giampaolo Jun 22, 2024
c1d0ea4
avoid installing unneded deps on GHA
giampaolo Jun 22, 2024
13be4f3
attempt 3
giampaolo Jun 23, 2024
045463a
attempt 4
giampaolo Jun 23, 2024
c17152d
update ruff rules
giampaolo Jul 3, 2024
7caf15d
Merge branch 'master' into pytest
giampaolo Jul 7, 2024
e9a2a11
use short traceback
giampaolo Jul 7, 2024
562bc84
rm teyit + make fix-unittests target
giampaolo Jul 7, 2024
da580b4
disable failing test
giampaolo Jul 8, 2024
57c0ef0
progress
giampaolo Jul 12, 2024
667f1e7
fix ruff
giampaolo Jul 12, 2024
87a5999
re-enable CI platforms
giampaolo Jul 27, 2024
0f450b8
bump up cibuildwheel ver
giampaolo Jul 27, 2024
07984c1
attempt 1
giampaolo Jul 27, 2024
666cd81
install pytest
giampaolo Jul 27, 2024
22e7f88
adjust path
giampaolo Jul 27, 2024
9deea3f
adjust path 2
giampaolo Jul 27, 2024
8871a08
progress
giampaolo Jul 27, 2024
f04e92c
progress
giampaolo Jul 27, 2024
8cc2f17
merge from master
giampaolo Sep 30, 2024
516ed56
add pytest dep
giampaolo Sep 30, 2024
65b7aab
attempt
giampaolo Sep 30, 2024
3861914
attempt 2
giampaolo Sep 30, 2024
ef60bfc
Merge branch 'master' into pytest
giampaolo Oct 1, 2024
f9f374d
attempt 3
giampaolo Oct 1, 2024
1a96b3e
progress
giampaolo Oct 1, 2024
8f83395
progress2
giampaolo Oct 1, 2024
904b849
progress 3
giampaolo Oct 1, 2024
6615db4
progress 4
giampaolo Oct 1, 2024
936e4ed
progress 5
giampaolo Oct 1, 2024
785f9b3
progress 6
giampaolo Oct 1, 2024
82fdc64
progress 7
giampaolo Oct 1, 2024
a50aa7a
progress 8
giampaolo Oct 1, 2024
7933aa1
progress 9
giampaolo Oct 1, 2024
4bef550
progress 10
giampaolo Oct 1, 2024
172c3dd
progress 11
giampaolo Oct 1, 2024
901ad75
progress 12
giampaolo Oct 1, 2024
840258f
progress 13
giampaolo Oct 1, 2024
464571d
progress 14
giampaolo Oct 1, 2024
6ecee70
progress 15
giampaolo Oct 1, 2024
3add3ed
progress 16
giampaolo Oct 1, 2024
ae3fb00
progress 17
giampaolo Oct 1, 2024
0b20ce3
progress 18
giampaolo Oct 1, 2024
8ff70d4
progress 19
giampaolo Oct 1, 2024
bee3417
progress 20
giampaolo Oct 1, 2024
ce52218
progress 21
giampaolo Oct 1, 2024
334bac6
progress 22
giampaolo Oct 1, 2024
af76047
progress 23
giampaolo Oct 1, 2024
7d54440
resync pyproject.toml with master
giampaolo Oct 1, 2024
04f95d5
resync pyproject.toml with master
giampaolo Oct 1, 2024
ff88052
resync with master
giampaolo Oct 1, 2024
1686b3b
print sysinfo when tests start
giampaolo Oct 1, 2024
3e2c62b
progress 24
giampaolo Oct 1, 2024
6ac9233
adjust test case for AARCH64
giampaolo Oct 1, 2024
fe884c7
try running bsd tests
giampaolo Oct 1, 2024
56c81f0
revert prev commit
giampaolo Oct 1, 2024
d6bb787
add pytest-xdist dep on windows
giampaolo Oct 1, 2024
2e7ef43
try to fix winmake execution
giampaolo Oct 1, 2024
438d10e
winmake refact
giampaolo Oct 1, 2024
0e52a73
winmake refact
giampaolo Oct 1, 2024
3f24634
winmake refact 2
giampaolo Oct 1, 2024
2e82048
try to adjust insta-pip target
giampaolo Oct 1, 2024
49ee3c9
adjust deps
giampaolo Oct 1, 2024
dd608d9
adjust deps
giampaolo Oct 1, 2024
4106c7b
disable bsd
giampaolo Oct 1, 2024
27ab0e6
progress
giampaolo Oct 1, 2024
b3e33cd
progress
giampaolo Oct 1, 2024
a33358b
progress 2
giampaolo Oct 1, 2024
40af359
progress 3
giampaolo Oct 1, 2024
52c1e5e
progress
giampaolo Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion psutil/_psaix.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def wrapper(self, *args, **kwargs):
class Process:
"""Wrapper class around underlying C implementation."""

__slots__ = ["pid", "_name", "_ppid", "_procfs_path", "_cache"]
__slots__ = ["_cache", "_name", "_ppid", "_procfs_path", "pid"]

def __init__(self, pid):
self.pid = pid
Expand Down
2 changes: 1 addition & 1 deletion psutil/_psbsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def wrap_exceptions_procfs(inst):
class Process:
"""Wrapper class around underlying C implementation."""

__slots__ = ["pid", "_name", "_ppid", "_cache"]
__slots__ = ["_cache", "_name", "_ppid", "pid"]

def __init__(self, pid):
self.pid = pid
Expand Down
2 changes: 1 addition & 1 deletion psutil/_pslinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,7 @@ def wrapper(self, *args, **kwargs):
class Process:
"""Linux process implementation."""

__slots__ = ["pid", "_name", "_ppid", "_procfs_path", "_cache"]
__slots__ = ["_cache", "_name", "_ppid", "_procfs_path", "pid"]

def __init__(self, pid):
self.pid = pid
Expand Down
2 changes: 1 addition & 1 deletion psutil/_psosx.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def wrapper(self, *args, **kwargs):
class Process:
"""Wrapper class around underlying C implementation."""

__slots__ = ["pid", "_name", "_ppid", "_cache"]
__slots__ = ["_cache", "_name", "_ppid", "pid"]

def __init__(self, pid):
self.pid = pid
Expand Down
2 changes: 1 addition & 1 deletion psutil/_pssunos.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def wrapper(self, *args, **kwargs):
class Process:
"""Wrapper class around underlying C implementation."""

__slots__ = ["pid", "_name", "_ppid", "_procfs_path", "_cache"]
__slots__ = ["_cache", "_name", "_ppid", "_procfs_path", "pid"]

def __init__(self, pid):
self.pid = pid
Expand Down
2 changes: 1 addition & 1 deletion psutil/_pswindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ def wrapper(self, *args, **kwargs):
class Process:
"""Wrapper class around underlying C implementation."""

__slots__ = ["pid", "_name", "_ppid", "_cache"]
__slots__ = ["_cache", "_name", "_ppid", "pid"]

def __init__(self, pid):
self.pid = pid
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def test_pids(self):
pids_psutil = psutil.pids()

# on MACOS and OPENBSD ps doesn't show pid 0
if MACOS or OPENBSD and 0 not in pids_ps:
if MACOS or (OPENBSD and 0 not in pids_ps):
pids_ps.insert(0, 0)

# There will often be one more process in pids_ps for ps itself
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def test_memory_full_info(self):
for name in mem._fields:
value = getattr(mem, name)
self.assertGreaterEqual(value, 0, msg=(name, value))
if name == 'vms' and OSX or LINUX:
if (name == 'vms' and OSX) or LINUX:
continue
self.assertLessEqual(value, total, msg=(name, value, total))
if LINUX or WINDOWS or MACOS:
Expand Down
2 changes: 1 addition & 1 deletion psutil/tests/test_process_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def memory_full_info(self, ret, info):
value = getattr(ret, name)
self.assertIsInstance(value, (int, long))
self.assertGreaterEqual(value, 0, msg=(name, value))
if LINUX or OSX and name in ('vms', 'data'):
if LINUX or (OSX and name in ('vms', 'data')):
# On Linux there are processes (e.g. 'goa-daemon') whose
# VMS is incredibly high for some reason.
continue
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ select = [
"D301", # Use `r"""` if any backslashes in a docstring
"D403", # [*] First word of the first line should be capitalized
"PERF102", # [*] When using only the keys of a dict use the `keys()` method
"PLR5501", # [*] Use `elif` instead of `else` then `if`, to reduce indentation
"PLR6104", # Use `+=` to perform an augmented assignment directly
"PLW0602", # Using global for `x` but no assignment is done
"RET507", # Unnecessary `elif` after `continue` statement
"RUF021", # [*] Parenthesize `a and b` expressions when chaining `and` and `or` together, to make the precedence clear
"RUF023", # [*] `Class.__slots__` is not sorted
"S113", # Probable use of requests call without timeout
"S602", # `subprocess` call with `shell=True` identified, security issue
]
Expand Down
6 changes: 2 additions & 4 deletions scripts/pidof.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ def pidof(pgname):
pids = []
for proc in psutil.process_iter(['name', 'cmdline']):
# search for matches in the process name and cmdline
if (
proc.info['name'] == pgname
or proc.info['cmdline']
and proc.info['cmdline'][0] == pgname
if proc.info['name'] == pgname or (
proc.info['cmdline'] and proc.info['cmdline'][0] == pgname
):
pids.append(str(proc.pid))
return pids
Expand Down