From: Sana Sharma <sansshar@redhat.com>
To: linux-rt-users@vger.kernel.org
Cc: jkacur@redhat.com
Subject: [PATCH v1] rteval: Fixed hardcoded paths in class TestCpusetManagerCLIIntegration
Date: Mon, 19 Oct 2026 16:46:40 -0400 [thread overview]
Message-ID: <ataBsDgEsnq-WTfe@fedora> (raw)
This patch makes 2 changes to the tests/test_cpusetmanager.py file
1. The hardcoded paths introduced in commit 6227294897b7 ("rteval:
Add --housekeeping-isolated flag") have been made generic
2. The os.path.dirname invocation has been replaced with a more
modern pathlib module since I was importing it for the fix.
Signed-off-by: Sana Sharma <sansshar@redhat.com>
---
tests/test_cpusetmanager.py | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/tests/test_cpusetmanager.py b/tests/test_cpusetmanager.py
index 3f1c4b4..f3f8c55 100644
--- a/tests/test_cpusetmanager.py
+++ b/tests/test_cpusetmanager.py
@@ -13,10 +13,10 @@ import os
import sys
import subprocess
import tempfile
+from pathlib import Path
# Add parent directory to path for imports
-sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-
+sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from rteval.cpusetmanager import CpusetManager
from rteval import cpuset
from rteval.Log import Log
@@ -209,6 +209,8 @@ class TestCpusetManagerHousekeepingPartitions(unittest.TestCase):
class TestCpusetManagerCLIIntegration(unittest.TestCase):
"""Test rteval-cmd integration with --housekeeping-isolated"""
+ srcdir = str(Path(__file__).resolve().parent.parent.parent)
+
def setUp(self):
"""Clean up before each test"""
try:
@@ -226,7 +228,7 @@ class TestCpusetManagerCLIIntegration(unittest.TestCase):
def test_housekeeping_isolated_requires_cpusets(self):
"""Test that --housekeeping-isolated requires --cpusets"""
result = subprocess.run(
- [sys.executable, '/home/jkacur/src/rteval/rteval-cmd',
+ [sys.executable, f"{self.srcdir}/rteval/rteval-cmd",
'--housekeeping', '0-1', '--housekeeping-isolated',
'--duration', '1', '--onlyload'],
capture_output=True,
@@ -241,7 +243,7 @@ class TestCpusetManagerCLIIntegration(unittest.TestCase):
def test_measurement_member_requires_cpusets(self):
"""Test that --measurement-member requires --cpusets"""
result = subprocess.run(
- [sys.executable, '/home/jkacur/src/rteval/rteval-cmd',
+ [sys.executable, f"{self.srcdir}/rteval/rteval-cmd",
'--measurement-member',
'--duration', '1', '--onlyload'],
capture_output=True,
@@ -256,7 +258,7 @@ class TestCpusetManagerCLIIntegration(unittest.TestCase):
def test_measurement_member_help_text(self):
"""Test that --measurement-member appears in help"""
result = subprocess.run(
- [sys.executable, '/home/jkacur/src/rteval/rteval-cmd', '--help'],
+ [sys.executable, f"{self.srcdir}/rteval/rteval-cmd", '--help'],
capture_output=True,
text=True
)
@@ -270,7 +272,7 @@ class TestCpusetManagerCLIIntegration(unittest.TestCase):
def test_loads_cpuset_requires_cpusets(self):
"""Test that --loads-cpuset requires --cpusets"""
result = subprocess.run(
- [sys.executable, '/home/jkacur/src/rteval/rteval-cmd',
+ [sys.executable, f"{self.srcdir}/rteval/rteval-cmd",
'--loads-cpuset',
'--duration', '1', '--onlyload'],
capture_output=True,
@@ -285,7 +287,7 @@ class TestCpusetManagerCLIIntegration(unittest.TestCase):
def test_loads_cpuset_help_text(self):
"""Test that --loads-cpuset appears in help"""
result = subprocess.run(
- [sys.executable, '/home/jkacur/src/rteval/rteval-cmd', '--help'],
+ [sys.executable, f"{self.srcdir}/rteval/rteval-cmd", '--help'],
capture_output=True,
text=True
)
@@ -299,7 +301,7 @@ class TestCpusetManagerCLIIntegration(unittest.TestCase):
def test_housekeeping_isolated_requires_housekeeping(self):
"""Test that --housekeeping-isolated requires --housekeeping"""
result = subprocess.run(
- [sys.executable, '/home/jkacur/src/rteval/rteval-cmd',
+ [sys.executable, f"{self.srcdir}/rteval/rteval-cmd",
'--cpusets', '--housekeeping-isolated',
'--duration', '1', '--onlyload'],
capture_output=True,
@@ -314,7 +316,7 @@ class TestCpusetManagerCLIIntegration(unittest.TestCase):
def test_housekeeping_isolated_help_text(self):
"""Test that --housekeeping-isolated appears in help"""
result = subprocess.run(
- [sys.executable, '/home/jkacur/src/rteval/rteval-cmd', '--help'],
+ [sys.executable, f"{self.srcdir}/rteval/rteval-cmd", '--help'],
capture_output=True,
text=True
)
@@ -328,7 +330,7 @@ class TestCpusetManagerCLIIntegration(unittest.TestCase):
def test_housekeeping_help_text_accuracy(self):
"""Test that --housekeeping help text is accurate (no longer says 'isolated CPUs')"""
result = subprocess.run(
- [sys.executable, '/home/jkacur/src/rteval/rteval-cmd', '--help'],
+ [sys.executable, f"{self.srcdir}/rteval/rteval-cmd", '--help'],
capture_output=True,
text=True
)
--
2.54.0
--
Sana Sharma <sansshar@redhat.com>
reply other threads:[~2026-10-19 20:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ataBsDgEsnq-WTfe@fedora \
--to=sansshar@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-rt-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.