コード例 #1
0
def test_get_submit_py_files_basic(tmp_path, caplog):
    (tmp_path / "lib.whl").touch()
    (tmp_path / "zop.zip").touch()
    (tmp_path / "__pyfiles__").mkdir()
    (tmp_path / "__pyfiles__" / "stuff.py").touch()
    env = {"OPENEO_SPARK_SUBMIT_PY_FILES": "stuff.py,lib.whl,foo.py"}
    py_files = GpsBatchJobs.get_submit_py_files(env=env, cwd=tmp_path)
    assert py_files == "__pyfiles__/stuff.py,lib.whl"
    warn_logs = [r.message for r in caplog.records if r.levelname == "WARNING"]
    assert warn_logs == ["Could not find 'py-file' foo.py: skipping"]
コード例 #2
0
def test_get_submit_py_files_deep_paths(tmp_path, caplog):
    # Originally submitted py-files
    env = {
        "OPENEO_SPARK_SUBMIT_PY_FILES": "data/deps/stuff.py,data/deps/lib.whl"
    }
    # Resources of flask app job.
    (tmp_path / "lib.whl").touch()
    (tmp_path / "__pyfiles__").mkdir()
    (tmp_path / "__pyfiles__" / "stuff.py").touch()
    py_files = GpsBatchJobs.get_submit_py_files(env=env, cwd=tmp_path)
    assert py_files == "__pyfiles__/stuff.py,lib.whl"
    warn_logs = [r.message for r in caplog.records if r.levelname == "WARNING"]
    assert warn_logs == []
コード例 #3
0
def test_get_submit_py_files_empty(tmp_path):
    env = {"OPENEO_SPARK_SUBMIT_PY_FILES": ""}
    py_files = GpsBatchJobs.get_submit_py_files(env=env, cwd=tmp_path)
    assert py_files == ""
コード例 #4
0
def test_get_submit_py_files_no_env(tmp_path):
    py_files = GpsBatchJobs.get_submit_py_files(env={}, cwd=tmp_path)
    assert py_files == ""