|
6 | 6 | """
|
7 | 7 |
|
8 | 8 | import os
|
9 |
| -import sys |
10 | 9 |
|
11 |
| -from test_framework.test_framework import BitcoinTestFramework, SkipTest |
| 10 | +from test_framework.test_framework import BitcoinTestFramework |
12 | 11 |
|
13 | 12 |
|
14 | 13 | def rename_and_link(*, from_name, to_name):
|
15 | 14 | os.rename(from_name, to_name)
|
16 | 15 | os.symlink(to_name, from_name)
|
17 | 16 | assert os.path.islink(from_name) and os.path.isdir(from_name)
|
18 | 17 |
|
19 |
| -class SymlinkTest(BitcoinTestFramework): |
20 |
| - def skip_test_if_missing_module(self): |
21 |
| - if sys.platform == 'win32': |
22 |
| - raise SkipTest("Symlinks test skipped on Windows") |
23 | 18 |
|
| 19 | +class SymlinkTest(BitcoinTestFramework): |
24 | 20 | def set_test_params(self):
|
25 | 21 | self.num_nodes = 1
|
26 | 22 |
|
27 | 23 | def run_test(self):
|
| 24 | + dir_new_blocks = self.nodes[0].chain_path / "new_blocks" |
| 25 | + dir_new_chainstate = self.nodes[0].chain_path / "new_chainstate" |
28 | 26 | self.stop_node(0)
|
29 | 27 |
|
30 |
| - rename_and_link(from_name=os.path.join(self.nodes[0].datadir, self.chain, "blocks"), |
31 |
| - to_name=os.path.join(self.nodes[0].datadir, self.chain, "newblocks")) |
32 |
| - rename_and_link(from_name=os.path.join(self.nodes[0].datadir, self.chain, "chainstate"), |
33 |
| - to_name=os.path.join(self.nodes[0].datadir, self.chain, "newchainstate")) |
| 28 | + rename_and_link( |
| 29 | + from_name=self.nodes[0].chain_path / "blocks", |
| 30 | + to_name=dir_new_blocks, |
| 31 | + ) |
| 32 | + rename_and_link( |
| 33 | + from_name=self.nodes[0].chain_path / "chainstate", |
| 34 | + to_name=dir_new_chainstate, |
| 35 | + ) |
34 | 36 |
|
35 | 37 | self.start_node(0)
|
36 | 38 |
|
37 | 39 |
|
38 |
| -if __name__ == '__main__': |
| 40 | +if __name__ == "__main__": |
39 | 41 | SymlinkTest().main()
|
0 commit comments