pliers icon indicating copy to clipboard operation
pliers copied to clipboard

a single test failing with permission denied when running in docker as a "pliers" user

Open yarikoptic opened this issue 5 years ago • 0 comments

on top of #347 decided to add running tests while building docker image from within WORKDIR... the only one failing is

=================================== FAILURES ===================================
________________________ test_load_from_standard_paths _________________________

    def test_load_from_standard_paths():

        # Verify defaults
        reset_options(update_from_file=False)
        assert pliers.config._settings == pliers.config._default_settings

        # Verify that PLIERS_CONFIG and local dir take precedence
        env_config = {"n_jobs": 200, "log_transformations": False}
        cwd_config = {"log_transformations": True, "parallelize": True}

        handle, f = tempfile.mkstemp(suffix='.json')
        json.dump(env_config, open(f, 'w'))
        os.environ['PLIERS_CONFIG'] = f

        target = 'pliers_config.json'
        if os.path.exists(target):
            pytest.skip("Cannot test pliers config because the default config file"
                        " (pliers_config.json) already exists in the current "
                        "working directory. Skipping test to avoid overwriting.")
>       json.dump(cwd_config, open(target, 'w'))
E       PermissionError: [Errno 13] Permission denied: 'pliers_config.json'

/opt/pliers/pliers/tests/test_config.py:28: PermissionError
=============================== warnings summary ===============================

shouldn't it just skip the test then? or ideally never write in the current directory. also it would fail now if config exists but a broken symlink (annexed file) -- use lexists not just exists for that

yarikoptic avatar May 10 '19 18:05 yarikoptic