Example #1
0
def test_clear_pycondor_environment_variables():
    # Set pycondor-related environment variables
    for i in ['submit', 'output', 'error', 'log']:
        os.environ['PYCONDOR_{}_DIR'.format(i.upper())] = 'something'

    # Test that environment variables are cleared
    clear_pycondor_environment_variables()
    for i in ['submit', 'output', 'error', 'log']:
        assert os.getenv('PYCONDOR_{}_DIR'.format(i.upper())) is None
Example #2
0
import os
import sys
import shutil
from distutils import spawn
import warnings
import pytest
from pycondor import Job, Dagman
from pycondor.utils import clear_pycondor_environment_variables
warnings.simplefilter('always')

clear_pycondor_environment_variables()

here = os.path.abspath(os.path.dirname(__file__))
example_script = os.path.join(here, 'example_script.py')


@pytest.fixture()
def job(tmpdir_factory):
    submit_dir = str(tmpdir_factory.mktemp('submit'))
    job = Job('jobname', example_script, submit=submit_dir)
    return job


@pytest.fixture()
def monkeypatch_condor_submit(monkeypatch):
    # Want to monkeypatch shutil.which to mimic condor_submit existing
    version_major = sys.version_info.major
    version_minor = sys.version_info.minor
    if (version_major, version_minor) >= (3, 3):
        monkeypatch.setattr(shutil, 'which', lambda x: 'submit_exists.exe')
    else:
Example #3
0
def test_clear_pycondor_environment_variables():
    # Test that environment variables are cleared
    clear_pycondor_environment_variables()
    for i in ['submit', 'output', 'error', 'log']:
        assert os.environ['PYCONDOR_{}_DIR'.format(i.upper())] == ''