diff --git a/src/borg/selftest.py b/src/borg/selftest.py index 7c5d4e2c6..935151fb4 100644 --- a/src/borg/selftest.py +++ b/src/borg/selftest.py @@ -21,13 +21,12 @@ import sys import time from unittest import TestResult, TestSuite, defaultTestLoader -from .testsuite.hashindex_test import HashIndexRefcountingTestCase from .testsuite.crypto_test import CryptoTestCase from .testsuite.chunker_test import ChunkerTestCase -SELFTEST_CASES = [HashIndexRefcountingTestCase, CryptoTestCase, ChunkerTestCase] +SELFTEST_CASES = [CryptoTestCase, ChunkerTestCase] -SELFTEST_COUNT = 13 +SELFTEST_COUNT = 11 class SelfTestResult(TestResult): diff --git a/src/borg/testsuite/hashindex_test.py b/src/borg/testsuite/hashindex_test.py index fcfa6fee5..539242835 100644 --- a/src/borg/testsuite/hashindex_test.py +++ b/src/borg/testsuite/hashindex_test.py @@ -1,11 +1,9 @@ -# Note: these tests are part of the self test, do not use or import pytest functionality here. -# See borg.selftest for details. If you add/remove test methods, update SELFTEST_COUNT - import hashlib import struct +import pytest + from ..hashindex import ChunkIndex -from . import BaseTestCase def H(x): @@ -18,19 +16,19 @@ def H2(x): return hashlib.sha256(H(x)).digest() -class HashIndexRefcountingTestCase(BaseTestCase): - def test_chunkindex_add(self): - chunks = ChunkIndex() - x = H2(1) - chunks.add(x, 5, 6) - assert chunks[x] == (5, 6) - chunks.add(x, 1, 2) - assert chunks[x] == (6, 2) +def test_chunkindex_add(): + chunks = ChunkIndex() + x = H2(1) + chunks.add(x, 5, 6) + assert chunks[x] == (5, 6) + chunks.add(x, 1, 2) + assert chunks[x] == (6, 2) - def test_keyerror(self): - chunks = ChunkIndex() - x = H2(1) - with self.assert_raises(KeyError): - chunks[x] - with self.assert_raises(struct.error): - chunks.add(x, -1, 0) + +def test_keyerror(): + chunks = ChunkIndex() + x = H2(1) + with pytest.raises(KeyError): + chunks[x] + with pytest.raises(struct.error): + chunks.add(x, -1, 0)