ya2 · news · projects · code · about

renamed lib to ya2
[pmachines.git] / tests / test_setup.py
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
10 from ya2.build.build import exec_cmd
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())
23 ncores = int(exec_cmd('grep -c ^processor /proc/cpuinfo'))
24 self.assertEqual(cmd.cores, ncores)
25 sys.argv += ['--cores=2']
26 cmd = AbsCmd(Distribution())
27 self.assertEqual(cmd.cores, 2)