This is what my code looks like in the code field below. When I run it, the results for my_dir and network_json are equal 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 test_json_networks.py 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))
print operation results:
======================== 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, which variable or environment setting do I need to configure for the Python unit test so that it can see my file in the correct directory at:
C: \ Users \ sepham \ Documents \ LiClipse Workspace \ sengtool_data_funnel \ tests \ test_networks
, IDClip LiClipse.
, python unit-test, :
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
, , :
C:\Users\sepham\ \ LiClipse\sengtool_data_funnel