aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-21 09:59:42 +0200
committerDanilo M. <danix@danix.xyz>2026-10-21 09:59:42 +0200
commit84f9e0cbbdc83953011ab6a23788d71561c7c7ed (patch)
tree0a5391aae0347a251e8ad58be9e8ee54d0d525b4 /tests
parent84b5fdef32db578d76a6128cf5f4b891a943d078 (diff)
downloadsb-builder-84f9e0cbbdc83953011ab6a23788d71561c7c7ed.tar.gz
sb-builder-84f9e0cbbdc83953011ab6a23788d71561c7c7ed.zip
Repository tab: built packages from the local repo mount
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gui.py42
1 files changed, 39 insertions, 3 deletions
diff --git a/tests/test_gui.py b/tests/test_gui.py
index 44418ac..73146c1 100644
--- a/tests/test_gui.py
+++ b/tests/test_gui.py
@@ -430,7 +430,7 @@ class SmokeTest(unittest.TestCase):
self.assertEqual(w.dashboard.legend.text(), "n/a")
jobs = w.open_jobs()
self.assertIs(w.open_jobs(), jobs)
- self.assertEqual(w.tabs.count(), 5)
+ self.assertEqual(w.tabs.count(), 6)
self.assertEqual([a.text() for a in jobs.pull_menu.actions()], ["personal (preview)"])
jobs.pull_menu.actions()[0].trigger()
self.assertIn(("job-start", "sbpull", "personal", "--no"), remote.calls)
@@ -627,11 +627,46 @@ class SmokeTest(unittest.TestCase):
w.dashboard.jobs.clicked.emit()
self.assertIs(w.tabs.currentWidget(), w.jobs_tab)
+ def wait(self, cond, secs=5):
+ end = time.time() + secs
+ while not cond() and time.time() < end:
+ app.processEvents()
+ self.assertTrue(cond())
+
+ def test_repository_tab(self):
+ root = tempfile.mkdtemp()
+ self.addCleanup(shutil.rmtree, root)
+ make_repo(root)
+ w, _remote = self.window()
+ w.cfg["repository"]["path"] = root
+ tab = w.repository_tab
+ w.tabs.setCurrentWidget(tab)
+ self.wait(lambda: tab.model.rows)
+ self.assertIn("2 packages", tab.stats.text())
+ self.assertEqual(tab.proxy.rowCount(), 2)
+ tab.chips["unpublished"].setChecked(True)
+ self.assertEqual(tab.proxy.rowCount(), 1)
+ tab.chips["unpublished"].setChecked(False)
+ tab.query.setText("test package")
+ self.assertEqual(tab.proxy.rowCount(), 1)
+ tab.table.setCurrentIndex(tab.proxy.index(0, 0))
+ self.assertIn("Updated for version 1.0.", tab.detail.text())
+ tab.link.linkActivated.emit("#")
+ self.assertIs(w.tabs.currentWidget(), w.packages_tab)
+ self.assertEqual(w.packages_tab.query.text(), "foo")
+
+ def test_repository_missing(self):
+ w, _remote = self.window()
+ w.cfg["repository"]["path"] = "/nonexistent/repo"
+ w.tabs.setCurrentWidget(w.repository_tab)
+ self.wait(lambda: "not a directory" in w.repository_tab.stats.text())
+
def test_ribbons_per_tab(self):
w, remote = self.window()
+ w.cfg["repository"]["path"] = "/nonexistent/repo"
w.poll_jobs()
self.assertEqual([w.tabs.tabText(i) for i in range(w.tabs.count())],
- ["Dashboard", "Packages", "Hints", "Results", "Jobs"])
+ ["Dashboard", "Packages", "Hints", "Results", "Repository", "Jobs"])
self.assertFalse(w.tabs.tabsClosable())
self.assertNotIn(("inventory",), remote.calls) # each tab loads on first show
expect = {
@@ -641,6 +676,7 @@ class SmokeTest(unittest.TestCase):
"Hints": (["Check upstream", "Update selected", "Delete hint", "Phantom deps…"],
["Select visible", "Clear", "No download", "Refresh"]),
"Results": (["Show build log"], ["Refresh"]),
+ "Repository": ([], ["Refresh"]),
"Jobs": (["Pull overlay", "Check shadowing", "Run it", "Kill"], []),
}
for i in range(w.tabs.count()):
@@ -851,7 +887,7 @@ class SmokeTest(unittest.TestCase):
nxt.activated.emit()
self.assertEqual(w.tabs.currentIndex(), 0) # wrapped from Jobs to Dashboard
prev.activated.emit()
- self.assertEqual(w.tabs.currentIndex(), 4)
+ self.assertEqual(w.tabs.currentIndex(), 5)
def test_results_tab(self):
w, remote = self.window()