Skip to content

Commit

Permalink
Merge pull request tardis-sn#1173 from epassaro/fix-plasma-tests
Browse files Browse the repository at this point in the history
Fix GUI and plasma tests
  • Loading branch information
marxwillia authored May 28, 2020
2 parents 5b05b90 + a364c4d commit bcd4c5f
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 66 deletions.
105 changes: 50 additions & 55 deletions azure-pipelines/simple_test_framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,61 @@
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python


trigger:
- master
- master

variables:
system.debug: 'true'
ref.data.home: '$(Agent.BuildDirectory)/tardis-refdata'
system.debug: "true"
ref.data.home: "$(Agent.BuildDirectory)/tardis-refdata"

ref.data.github.url: 'https://github.com/tardis-sn/tardis-refdata.git'
ref.data.github.url: "https://github.com/tardis-sn/tardis-refdata.git"
tardis.build.dir: $(Build.Repository.LocalPath)



jobs:

- job: 'Test'
pool:
vmImage: $[variables.vm_Image]

strategy:
matrix:
linux:
vm_Image: 'Ubuntu-16.04'
conda: '/usr/share/miniconda'
mac:
vm_Image: 'macOS-10.14'
miniconda.url: 'http://repo.continuum.io/miniconda/Miniconda2-latest-mac-x86_64.sh'
maxParallel: 4

steps:
- bash: |
- job: "Test"
pool:
vmImage: $[variables.vm_Image]

strategy:
matrix:
linux:
vm_Image: "Ubuntu-16.04"
conda: "/usr/share/miniconda"
mac:
vm_Image: "macOS-10.14"
miniconda.url: "http://repo.continuum.io/miniconda/Miniconda2-latest-mac-x86_64.sh"
maxParallel: 4

steps:
- bash: |
echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH
- bash: |
sudo chown -R $USER $CONDA
# conda update -y conda
displayName: updating conda and activating
- bash: |
sh ci-helpers/install_tardis_env.sh
displayName: 'Install TARDIS env'
- bash: |
sh ci-helpers/fetch_reference_data.sh
displayName: 'Fetch Reference Data'
- bash: |
source activate tardis
python setup.py build_ext --inplace
displayName: 'TARDIS build'
- bash: |
source activate tardis
conda install -y pytest-cov
pip install git+https://github.com/tonybaloney/pytest-azurepipelines.git
export QT_API=pyqt
pytest tardis --tardis-refdata=$(ref.data.home) --cov=tardis --cov-report=xml --cov-report=html
displayName: 'TARDIS test'
- script: |
bash <(curl -s https://codecov.io/bash)
displayName: 'Upload to codecov.io'
displayName: Add conda to PATH
- bash: |
sudo chown -R $USER $CONDA
# conda update -y conda
displayName: updating conda and activating
- bash: |
sh ci-helpers/install_tardis_env.sh
displayName: "Install TARDIS env"
- bash: |
sh ci-helpers/fetch_reference_data.sh
displayName: "Fetch Reference Data"
- bash: |
source activate tardis
python setup.py build_ext --inplace
displayName: "TARDIS build"
- bash: |
source activate tardis
conda install -y pytest-cov
pip install git+https://github.com/tonybaloney/pytest-azurepipelines.git
pytest tardis --tardis-refdata=$(ref.data.home) --cov=tardis --cov-report=xml --cov-report=html
displayName: "TARDIS test"
- script: |
bash <(curl -s https://codecov.io/bash)
displayName: "Upload to codecov.io"
16 changes: 8 additions & 8 deletions tardis/gui/tests/test_gui.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
from PyQt5 import QtWidgets
import os
import pytest
from tardis.io.config_reader import Configuration
from tardis.simulation import Simulation
import astropy.units as u
from tardis.gui.widgets import Tardis
from tardis.gui.datahandler import SimpleTableModel
from PyQt5 import QtWidgets



if 'QT_API' in os.environ:
from tardis.gui.widgets import Tardis
from tardis.gui.datahandler import SimpleTableModel


@pytest.fixture(scope='module')
def refdata(tardis_ref_data):
def get_ref_data(key):
return tardis_ref_data[os.path.join(
'test_simulation', key)]
'test_simulation', key)]
return get_ref_data


@pytest.fixture(scope='module')
def config():
return Configuration.from_yaml(
'tardis/io/tests/data/tardis_configv1_verysimple.yml')
'tardis/io/tests/data/tardis_configv1_verysimple.yml')


@pytest.fixture(scope='module')
Expand All @@ -38,7 +37,8 @@ def simulation_one_loop(
simulation.run()

return simulation



@pytest.mark.skipif('QT_API' not in os.environ, reason="enviroment variable QT_API is not set")
def test_gui(simulation_one_loop):
simulation = simulation_one_loop
Expand Down
3 changes: 0 additions & 3 deletions tardis/io/atom_data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,6 @@ def __init__(self, atom_data, ionization_data, levels=None, lines=None,
# Convert energy to CGS
levels.loc[:, "energy"] = Quantity(levels["energy"].values, 'eV').cgs

# Sort the dataframe before indexing to improve performance
lines.sort_index(inplace=True)

# Create a new columns with wavelengths in the CGS units
lines.loc[:, 'wavelength_cm'] = Quantity(
lines['wavelength'], 'angstrom').cgs
Expand Down

0 comments on commit bcd4c5f

Please sign in to comment.