wtbarnes / fiasco

Python interface to the CHIANTI atomic database
http://fiasco.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
21 stars 17 forks source link

pytest not working? #264

Closed jwreep closed 7 months ago

jwreep commented 7 months ago

Not sure what I'm doing wrong, but I can't get pytest to run for the IDL comparisons. Copying and pasting the instruction from the docs:

(base) reep@atrcw9 fiasco % pytest --idl-executable=/Applications/harris/idl89/ \
--idl-codebase-root=/Users/reep/ssw/packages/chianti/idl/ \
--ascii-dbase-root=/Users/reep/ssw/packages/chianti/dbase/ \
--include-all-files \
fiasco/tests/idl/
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --doctest-rst
  inifile: /Users/reep/Documents/Forks/fiasco/pyproject.toml
  rootdir: /Users/reep/Documents/Forks/fiasco

hissw appears to be running with Chianti, so I don't think that's the issue.

(base) reep@atrcw9 chianti_dbase % python
Python 3.11.7 (main, Dec 15 2023, 12:09:56) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information. 
>>> import hissw
>>> ssw = hissw.Environment(ssw_packages=['chianti'])
>>> script='''
... print,max_temp('Fe X')
... '''
>>> ssw.run(script)
...

CHIANTI system variable !xuvtop set=/Users/reep/ssw//packages/chianti/dbase
You are using the CHIANTI database VERSION 10.1
CHIANTI system variable !ioneq_file set=/Users/reep/ssw//packages/chianti/dbase/ioneq/chianti.ioneq
CHIANTI system variable !abund_file set=/Users/reep/ssw//packages/chianti/dbase/abundance/sun_photospheric_2021_asplund.abund
-------------------------------------------------------------------

Executing SSW IDL_STARTUP for: SITE
% MAX_TEMP: using /Users/reep/ssw//packages/chianti/dbase/ioneq/chianti.ioneq

%ionization equilibrium:  CHIANTI
 produced as part of the CHIANTI atomic data base collaboration
  Created on Tue May 30 16:53:01 2023
%comment:
  Prepared for the release of CHIANTI 10.1.

      6.00000

{}
wtbarnes commented 7 months ago

I think you might not have one of the needed pytest plugins installed. Two things to check:

  1. What does which pytest return? i.e. are you using the right version of pytest. I find that I bump into this error when I'm not using the version of pytest that I think I've installed into my environment.
  2. Check to see if you have the pytest-astropy package installed. If not, run pip install pytest-astropy.

The root cause of this error is not having the expected pytest plugin to run the doctests. Installing the pytest-astropy plugin should fix that.

jwreep commented 7 months ago

Thanks, that was it! I didn't have pytest-astropy installed.

I've moved on to a new error -- wrong database version! Progress.

wtbarnes commented 7 months ago

Ha new problems are better than the same problem!