Пример #1
0
def test_run_tessphot_mpi(PRIVATE_INPUT_DIR):

    stars_to_test = ([260795451, 'tpf'], [260795451, 'ffi'])

    with TaskManager(PRIVATE_INPUT_DIR) as tm:
        tm.cursor.execute("UPDATE todolist SET status=1;")
        for starid, datasource in stars_to_test:
            tm.cursor.execute(
                "UPDATE todolist SET status=NULL WHERE starid=? AND datasource=?;",
                [starid, datasource])
        tm.conn.commit()
        tm.cursor.execute(
            "SELECT COUNT(*) FROM todolist WHERE status IS NULL;")
        num = tm.cursor.fetchone()[0]

    print(num)
    assert num == len(stars_to_test)

    out, err, exitcode = capture_cli(
        'run_tessphot_mpi.py',
        mpiexec=True,
        params=['--debug', '--version=0', PRIVATE_INPUT_DIR])

    assert ' - INFO - %d tasks to be run' % num in err
    assert ' - INFO - Master starting with 1 workers' in err
    assert ' - DEBUG - Got data from worker 1: {' in err
    assert ' - INFO - Worker 1 exited.' in err
    assert ' - INFO - Master finishing' in err
    assert exitcode == 0
Пример #2
0
def test_run_prepare_photometry(PRIVATE_INPUT_DIR):

	hdf5file = os.path.join(PRIVATE_INPUT_DIR, 'sector001_camera3_ccd2.hdf5')
	os.remove(hdf5file)

	out, err, exitcode = capture_cli('run_prepare_photometry.py', params=['--camera=3', '--ccd=2', PRIVATE_INPUT_DIR])

	assert exitcode == 0
	assert os.path.isfile(hdf5file), "HDF5 was not created"

	hdf5_file_valid(hdf5file)
Пример #3
0
def test_run_ffimovie(SHARED_INPUT_DIR):

    out, err, exitcode = capture_cli('run_ffimovie.py',
                                     params=[SHARED_INPUT_DIR])

    assert exitcode == 0

    for fname in ('sector001_camera3_ccd2.mp4',
                  'sector001_combined_backgrounds.mp4',
                  'sector001_combined_flags.mp4',
                  'sector001_combined_images.mp4',
                  'sector001_combined_originals.mp4'):

        mp4file = os.path.join(SHARED_INPUT_DIR, fname)
        assert os.path.isfile(mp4file), "MP4 was not created: " + fname
Пример #4
0
def test_make_todolist_cli(PRIVATE_INPUT_DIR):

    # Path to the TODO-file:
    todofile = os.path.join(PRIVATE_INPUT_DIR, 'todo.sqlite')

    # Delete existing todo-file:
    os.remove(todofile)

    # Run make_todo CLI script:
    out, err, exitcode = capture_cli(
        'make_todo.py', params=['--camera=3', '--ccd=2', PRIVATE_INPUT_DIR])

    assert exitcode == 0
    assert '- ERROR -' not in out
    assert '- ERROR -' not in err
    assert '- INFO - TODO done.' in err

    assert os.path.isfile(todofile), "TODO-file was not created"
    todo_file_valid(todofile)
Пример #5
0
def test_run_tessphot_mpi_invalid_ccd():
    out, err, exitcode = capture_cli('run_tessphot_mpi.py',
                                     params=["--ccd=14"])
    assert exitcode == 2
    assert 'error: argument --ccd: invalid choice: 14 (choose from 1, 2, 3, 4)' in err
Пример #6
0
def test_run_tessphot_mpi_invalid_datasource():
    out, err, exitcode = capture_cli('run_tessphot_mpi.py',
                                     params=["--datasource=invalid"])
    assert exitcode == 2
    assert "error: argument --datasource: invalid choice: 'invalid'" in err