1 from pathlib
import Path
3 if '' in sys
.path
: sys
.path
.remove('')
4 sys
.path
.append(str(Path(__file__
).parent
.parent
.parent
))
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
13 class SetupTests(TestCase
):
16 self
._prev
_argv
= sys
.argv
19 sys
.argv
= self
._prev
_argv
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)