File: tools.py

package info (click to toggle)
apt-xapian-index 0.58
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 448 kB
  • sloc: python: 2,959; ruby: 475; sh: 137; makefile: 31
file content (26 lines) | stat: -rwxr-xr-x 851 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
from __future__ import annotations

import os.path
import unittest

import axi
import axi.indexer


class AxiTestBase(unittest.TestCase):
    def assertCleanIndex(self) -> None:
        self.assert_(os.path.exists(axi.XAPIANINDEX))
        self.assert_(os.path.exists(axi.XAPIANDBSTAMP))
        self.assert_(os.path.exists(axi.XAPIANDBVALUES))
        self.assert_(os.path.exists(axi.XAPIANDBDOC))
        self.assert_(not os.path.exists(axi.XAPIANDBUPDATESOCK))
        indexer: axi.indexer.Indexer | None

        # Index is clean and up to date: an indexer should tell us that it does
        # not need to run
        progress = axi.indexer.SilentProgress()
        indexer = axi.indexer.Indexer(progress, True)
        self.assert_(indexer.lock())
        self.assert_(not indexer.setupIndexing())
        indexer = None