This is what my code looks like in the code box below. When I run it the results for my_dir and network_json are, respectively:
my_dir: C:\Users\sepham\My Documents\LiClipse Workspace\sengtool_data_funnel
network_json:
C:\Users\sepham\My Documents\LiClipse Workspace\sengtool_data_funnel\example_EventsOfInterestColumnAggregate.json
But my project directory structure for the test_json_networks.py file is as follows:
C:\Users\sepham\Documents\LiClipse Workspace\sengtool_data_funnel\tests\test_networks
json_files_input = [
'example_EventsOfInterestColumnAggregate.json',
'example_EventsOfInterestConcatenate.json']
@pytest.mark.parametrize('network_json', json_files_input)
def test_network_jsons(network_json):
my_dir = os.path.dirname(os.path.abspath(network_json))
network_json = os.path.join(my_dir, network_json)
print my_dir
print network_json
with open(network_json) as jdata:
network = Network.load(json.load(jdata))
results of the print statement:
======================== CAPTURED OUTPUT =========================
C:\Users\sepham\My Documents\LiClipse Workspace\sengtool_data_funnel
C:\Users\sepham\My Documents\LiClipse
Workspace\sengtool_data_funnel\example_EventsOfInterestColumnAggregate.json
The question is what environment variable or setting do I need to set up for Python unit-test so that it can see my file in correct directory at:
C:\Users\sepham\Documents\LiClipse Workspace\sengtool_data_funnel\tests\test_networks
By the way, i'm using the LiClipse IDE.
Also, this is the error message when running python unit-test because it cannot see my file to import:
E IOError: [Errno 2] No such file or directory: 'C:\\Users\\sepham\\My
Documents\\LiClipse
Workspace\\sengtool_data_funnel\\example_EventsOfInterestCo
lumnAggregate.json'
File "C:\Users\sepham\My Documents\LiClipse
Workspace\sengtool_data_funnel\tests\test_networks\test_json_networks.py",
line 58 IOError
If i place the file to import in the directory as below, then it works correctly:
C:\Users\sepham\My Documents\LiClipse Workspace\sengtool_data_funnel