test_cmd

Unit tests for command line execution.

Module Contents

Classes

TestCommandLine

Test class for the command-line apexpy interface.

class test_cmd.TestCommandLine[source]

Bases: object

Test class for the command-line apexpy interface.

setup_method()[source]

Runs before every test method to create a clean environment.

teardown_method()[source]

Runs after every method to clean up previous testing.

execute_command_line(command, command_kwargs=None, pipe_out=False)[source]

Execute the command and load data from self.outfile

Parameters
  • command (list or str) – List or string containing command to execute using subprocess

  • command_kwargs (dict or NoneType) – Dict containing optional kwargs for subprocess.Popen command or None if using defaults. (default=None)

  • pipe_out (bool) – Return pipe output instead of output from a data file if True (default=False)

Returns

data (np.array, NoneType, or subprocess.Popen attribute) – Numpy array of data from output file, None if no file was created, or the requested output from the pipe command.

test_convert_w_datetime(date_str)[source]

Test command line with different date and time specification.

Parameters

date_str (str) – Input date string

test_convert_single_line()[source]

Test command line with a single line of output.

test_convert_stdin_stdout_w_height_flags(height, out_list)[source]

Test use of pipe input to command-line call with height flags.

Parameters
  • height (str) – String specifying height with command line options

  • out_list (list) – List of expected output values

test_convert_mlt()[source]

Test magnetic local time conversion.

test_invalid_date(date_str)[source]

Test raises ValueError with an invalid input date.

Parameters

date_str (str) – Input date string

test_mlt_nodatetime()[source]

Test raises ValueError when time not provided for MLT calc.

test_invalid_coord(coords)[source]

Test raises error when bad coordinate input provided.

Parameters

coords (str) – Input/output coordinate pairs