コード例 #1
0
ファイル: helpers_test.py プロジェクト: s0undt3ch/pre-commit
def test_target_concurrency_testing_env_var():
    with mock.patch.dict(
            os.environ,
        {'PRE_COMMIT_NO_CONCURRENCY': '1'},
            clear=True,
    ):
        assert helpers.target_concurrency({'require_serial': False}) == 1
コード例 #2
0
def test_target_concurrency_testing_env_var():
    with mock.patch.dict(
            os.environ,
        {'PRE_COMMIT_NO_CONCURRENCY': '1'},
            clear=True,
    ):
        assert helpers.target_concurrency(SERIAL_FALSE) == 1
コード例 #3
0
def test_target_concurrency_cpu_count_not_implemented():
    with mock.patch.object(
            multiprocessing,
            'cpu_count',
            side_effect=NotImplementedError,
    ):
        with mock.patch.dict(os.environ, {}, clear=True):
            assert helpers.target_concurrency(SERIAL_FALSE) == 1
コード例 #4
0
def test_target_concurrency_on_travis():
    with mock.patch.dict(os.environ, {'TRAVIS': '1'}, clear=True):
        assert helpers.target_concurrency(SERIAL_FALSE) == 2
コード例 #5
0
def test_target_concurrency_cpu_count_require_serial_true():
    with mock.patch.dict(os.environ, {}, clear=True):
        assert helpers.target_concurrency(SERIAL_TRUE) == 1
コード例 #6
0
def test_target_concurrency_normal():
    with mock.patch.object(multiprocessing, 'cpu_count', return_value=123):
        with mock.patch.dict(os.environ, {}, clear=True):
            assert helpers.target_concurrency(SERIAL_FALSE) == 123
コード例 #7
0
ファイル: helpers_test.py プロジェクト: s0undt3ch/pre-commit
def test_target_concurrency_on_travis():
    with mock.patch.dict(os.environ, {'TRAVIS': '1'}, clear=True):
        assert helpers.target_concurrency({'require_serial': False}) == 2
コード例 #8
0
ファイル: helpers_test.py プロジェクト: s0undt3ch/pre-commit
def test_target_concurrency_normal():
    with mock.patch.object(multiprocessing, 'cpu_count', return_value=123):
        with mock.patch.dict(os.environ, {}, clear=True):
            assert helpers.target_concurrency({'require_serial': False}) == 123
コード例 #9
0
ファイル: helpers_test.py プロジェクト: pre-commit/pre-commit
def test_target_concurrency_cpu_count_not_implemented():
    with mock.patch.object(
            multiprocessing, 'cpu_count', side_effect=NotImplementedError,
    ):
        with mock.patch.dict(os.environ, {}, clear=True):
            assert helpers.target_concurrency(SERIAL_FALSE) == 1
コード例 #10
0
ファイル: helpers_test.py プロジェクト: pre-commit/pre-commit
def test_target_concurrency_on_travis():
    with mock.patch.dict(os.environ, {'TRAVIS': '1'}, clear=True):
        assert helpers.target_concurrency(SERIAL_FALSE) == 2
コード例 #11
0
ファイル: helpers_test.py プロジェクト: pre-commit/pre-commit
def test_target_concurrency_testing_env_var():
    with mock.patch.dict(
            os.environ, {'PRE_COMMIT_NO_CONCURRENCY': '1'}, clear=True,
    ):
        assert helpers.target_concurrency(SERIAL_FALSE) == 1
コード例 #12
0
ファイル: helpers_test.py プロジェクト: pre-commit/pre-commit
def test_target_concurrency_cpu_count_require_serial_true():
    with mock.patch.dict(os.environ, {}, clear=True):
        assert helpers.target_concurrency(SERIAL_TRUE) == 1
コード例 #13
0
ファイル: helpers_test.py プロジェクト: pre-commit/pre-commit
def test_target_concurrency_normal():
    with mock.patch.object(multiprocessing, 'cpu_count', return_value=123):
        with mock.patch.dict(os.environ, {}, clear=True):
            assert helpers.target_concurrency(SERIAL_FALSE) == 123