Question: I need help resolving this error: execute ( [ ' KITH - 2 0 1 7 ' , ' - - test' ] ) did
I need help resolving this error:
executeKITHtest' did not print out an error message
Implement execute
The main application function is execute. It takes the command line arguments and decides whether to call discoverviolations or tests.testall If the user provides a data file, the function runs discoverviolations. If the user provides the argument test it runs the main test function.
You have already seen an example of something similar in the course videos. The application tocelsius contains a function execute that can either be used to test the function or run the temperature application. This code is available in the samples folder under unit Take a look at this sample code now and use it to complete your execute function.
When you have finished this function, run the test script. Better yet, try to run the tests directly from the application as follows:
codio@mikepanther:~workspace$ python auditor test
Testing module utils
def executeargs:
Executes the application or prints an error message if executed incorrectly.
The arguments to the application EXCLUDING the application name are provided to
the list args. This list should contain either or elements. If there is one
element, it should be the name of the data set folder or the value test'. If
there are two elements, the first should be the data set folder and the second
should be the name of a CSV file for output of the results
If the user calls this script incorrectly with the wrong number of arguments this
function prints:
Usage: python auditor dataset outputcsv
This function does not do much error checking beyond counting the number of arguments.
Parameter args: The command line arguments for the application minus the application name
Precondition: args is a list of strings
# Total arguments
n lenargs
# Print an error if the number of arguments is incorrect
if n or n :
printUsage: python auditor dataset outputcsv
return
if n :
if argstest':
# Call the test procedure header
printRunning test procedure..."
else:
printFolder name:", args
else:
foldername args
csvfilename args
# Check if the second argument is test' or a valid CSV file name
if csvfilename test' and not csvfilename.endswithcsv:
printInvalid second argument. Should be test" or a valid CSV file name.
return
printFolder name:", foldername
printCsv file name:", csvfilename
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
