Exemple #1
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({'require_serial': False}) == 1
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #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
Exemple #7
0
def test_target_concurrency_on_travis():
    with mock.patch.dict(os.environ, {'TRAVIS': '1'}, clear=True):
        assert helpers.target_concurrency({'require_serial': False}) == 2
Exemple #8
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({'require_serial': False}) == 123
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
Exemple #10
0
def test_target_concurrency_on_travis():
    with mock.patch.dict(os.environ, {'TRAVIS': '1'}, clear=True):
        assert helpers.target_concurrency(SERIAL_FALSE) == 2
Exemple #11
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
Exemple #12
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
Exemple #13
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