LBNL-ETA / Adapter

The Adapter software is developed at the Energy Efficiency Standards Department and it provides a convenient data table loader from various formats such as xlsx, csv, db (sqlite database), and sqlalchemy. Its main feature is the ability to convert data tables identified in one main and optionally one or more additional input files into database tables and Pandas DataFrames for downstream usage in any compatible software.
1 stars 1 forks source link

24 win path issue #25

Closed 0xd5dc closed 2 years ago

0xd5dc commented 2 years ago

this fix allows adapter handle both X:folder\file and X:\folder\file Windows path format.

evaneill commented 2 years ago

I think this change makes sense, I didn't know filepaths could be like that on windows.

But for me the new tests are failing:


FAIL: test_compare_output (adapter.comm.tests.test_tools.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/unittest/mock.py", line 1325, in patched
    return func(*newargs, **newkeywargs)
  File "/Users/eneill/repos/repo_copies/Adapter/adapter/comm/tests/test_tools.py", line 157, in test_compare_output
    self.assertEqual(
AssertionError: '/media/Abc/\\/First_Level/Second_Level/Third_Level/input' != '/media/Abc/First_Level/Second_Level/Third_Level/input'
- /media/Abc/\/First_Level/Second_Level/Third_Level/input
?           --
+ /media/Abc/First_Level/Second_Level/Third_Level/input

======================================================================
FAIL: test_compare_output2 (adapter.comm.tests.test_tools.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/unittest/mock.py", line 1325, in patched
    return func(*newargs, **newkeywargs)
  File "/Users/eneill/repos/repo_copies/Adapter/adapter/comm/tests/test_tools.py", line 180, in test_compare_output2
    self.assertEqual(
AssertionError: '/Volumes/Abc/\\/First_Level/Second_Level/Third_Level/input' != '/Volumes/Abc/First_Level/Second_Level/Third_Level/input'
- /Volumes/Abc/\/First_Level/Second_Level/Third_Level/input
?             --
+ /Volumes/Abc/First_Level/Second_Level/Third_Level/input
0xd5dc commented 2 years ago

I think this change makes sense, I didn't know filepaths could be like that on windows.

But for me the new tests are failing:


FAIL: test_compare_output (adapter.comm.tests.test_tools.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/unittest/mock.py", line 1325, in patched
    return func(*newargs, **newkeywargs)
  File "/Users/eneill/repos/repo_copies/Adapter/adapter/comm/tests/test_tools.py", line 157, in test_compare_output
    self.assertEqual(
AssertionError: '/media/Abc/\\/First_Level/Second_Level/Third_Level/input' != '/media/Abc/First_Level/Second_Level/Third_Level/input'
- /media/Abc/\/First_Level/Second_Level/Third_Level/input
?           --
+ /media/Abc/First_Level/Second_Level/Third_Level/input

======================================================================
FAIL: test_compare_output2 (adapter.comm.tests.test_tools.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/unittest/mock.py", line 1325, in patched
    return func(*newargs, **newkeywargs)
  File "/Users/eneill/repos/repo_copies/Adapter/adapter/comm/tests/test_tools.py", line 180, in test_compare_output2
    self.assertEqual(
AssertionError: '/Volumes/Abc/\\/First_Level/Second_Level/Third_Level/input' != '/Volumes/Abc/First_Level/Second_Level/Third_Level/input'
- /Volumes/Abc/\/First_Level/Second_Level/Third_Level/input
?             --
+ /Volumes/Abc/First_Level/Second_Level/Third_Level/input

The issue caused by os.path.join function running on Posix system. In your example, X:/First_Level/Second_Level/Third_Level/input generated under macOS.