Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GUI and plasma tests #1173

Merged
merged 3 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, YAML was formatted by VSCode. The only change here is the removal of the export QT_API=pyqt line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, could you make a note of it in the PR so no one in the future is confused why this looks like such a big change?

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