How to use the testpath.modified_env function in testpath

To help you get started, we’ve selected a few testpath examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github takluyver / flit / tests / test_upload.py View on Github external
def test_get_repository_keyring():
    with modified_env({'FLIT_PASSWORD': None}), \
            _fake_keyring('tops3cret'):
        repo = upload.get_repository(cfg_file=io.StringIO(pypirc2))

    assert repo['username'] == 'fred'
    assert repo['password'] == 'tops3cret'
github takluyver / entrypoints / tests / test_entrypoints.py View on Github external
def temp_cache_file():
    td = mkdtemp()
    cache_file = osp.join(td, 'cache.json')
    with modified_env({'ENTRYPOINTS_CACHE_FILE': cache_file}):
        yield cache_file
    shutil.rmtree(td)
github takluyver / flit / tests / test_upload.py View on Github external
def test_get_repository_env():
    with modified_env({
        'FLIT_INDEX_URL': 'https://pypi.example.com',
        'FLIT_USERNAME': 'alice',
        'FLIT_PASSWORD': 'p4ssword',  # Also not a real password
    }):
        repo = upload.get_repository(cfg_file=io.StringIO(pypirc1))
        # Because we haven't specified a repo name, environment variables should
        # have higher priority than the config file.
        assert repo['url'] == 'https://pypi.example.com'
        assert repo['username'] == 'alice'
        assert repo['password'] == 'p4ssword'

testpath

Test utilities for code working with files and commands

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

55 / 100
Full package analysis

Similar packages