tests don't run from pycharm
cmungall opened this issue · 1 comments
cmungall commented
/Users/cjm/Library/Caches/pypoetry/virtualenvs/semsim-UokXyP9h-py3.9/bin/python /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_unittest_runner.py --path /Users/cjm/repos/semsim/tests/test_get_phenodigm_pairs.py
Testing started at 3:40 PM ...
Launching unittests with arguments python -m unittest /Users/cjm/repos/semsim/tests/test_get_phenodigm_pairs.py in /Users/cjm/repos/semsim/tests
Error
Traceback (most recent call last):
File "/Users/cjm/repos/semsim/tests/test_get_phenodigm_pairs.py", line 40, in test_make_filtered_map
map_df = pd.read_csv(
File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/semsim-UokXyP9h-py3.9/lib/python3.9/site-packages/pandas/util/_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/semsim-UokXyP9h-py3.9/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 680, in read_csv
return _read(filepath_or_buffer, kwds)
File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/semsim-UokXyP9h-py3.9/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 575, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/semsim-UokXyP9h-py3.9/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 934, in __init__
self._engine = self._make_engine(f, self.engine)
File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/semsim-UokXyP9h-py3.9/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1218, in _make_engine
self.handles = get_handle( # type: ignore[call-overload]
File "/Users/cjm/Library/Caches/pypoetry/virtualenvs/semsim-UokXyP9h-py3.9/lib/python3.9/site-packages/pandas/io/common.py", line 786, in get_handle
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: 'tests/resources/test_mapping.csv'
Ran 2 tests in 0.011s
FAILED (errors=2)
Error
Traceback (most recent call last):
File "/Users/cjm/repos/semsim/tests/test_get_phenodigm_pairs.py", line 27, in test_make_phenodigm
make_phenodigm(
File "/Users/cjm/repos/semsim/semsim/get_phenodigm_pairs.py", line 46, in make_phenodigm
raise FileNotFoundError(f"Cannot find {filepath}!")
FileNotFoundError: Cannot find tests/resources/test_jaccard!
I recommend not constructing strings with "/"s, it's not very portable. Older code uses os.path.join but I recommend doing with Path, see:
justaddcoffee commented
One thing to check here in PyCharm is the working directory in your runtime configuration - PyCharm automatically sets this to the test/
directory, and breaks these tests with hardcoded paths to test fixtures
I recommend not constructing strings with "/"s, it's not very portable. Older code uses os.path.join but I recommend doing with Path, see:
https://github.com/INCATools/ontology-access-kit/blob/56778858b271838ce2db6cd6a4f87287952c68fa/tests/__init__.py#L1-L8
+1