Commit | Line | Data |
---|---|---|
0f9675ba FC |
1 | from pathlib import Path |
2 | import sys | |
3 | if '' in sys.path: sys.path.remove('') | |
4 | sys.path.append(str(Path(__file__).parent.parent.parent)) | |
5 | from os import remove | |
6 | from os.path import exists | |
7 | from unittest import TestCase | |
8 | from setuptools.dist import Distribution | |
9 | from setup import AbsCmd | |
53ddf3c3 | 10 | from ya2.build.build import exec_cmd |
0f9675ba FC |
11 | |
12 | ||
13 | class SetupTests(TestCase): | |
14 | ||
15 | def setUp(self): | |
16 | self._prev_argv = sys.argv | |
17 | ||
18 | def tearDown(self): | |
19 | sys.argv = self._prev_argv | |
20 | ||
21 | def test_cores(self): | |
22 | cmd = AbsCmd(Distribution()) | |
addec9c9 FC |
23 | ncores = int(exec_cmd('grep -c ^processor /proc/cpuinfo')) |
24 | self.assertEqual(cmd.cores, ncores) | |
0f9675ba FC |
25 | sys.argv += ['--cores=2'] |
26 | cmd = AbsCmd(Distribution()) | |
27 | self.assertEqual(cmd.cores, 2) |