Skip to content

Commit

Permalink
test pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
h0anle committed Sep 26, 2024
1 parent dbd1a39 commit 65402f8
Show file tree
Hide file tree
Showing 22 changed files with 91 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Python Tests

# Trigger the workflow on push or pull request
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.8, 3.9, 3.10, 3.11]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install
- name: Run tests
run: |
python -m pytest tests/
1 change: 1 addition & 0 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def open(self, file_paths=None):
- dataframes (Excel)
- saved work of SPECTROview (.maps, .spectra, .graphs)
"""

if file_paths is None:
# Initialize the last used directory from QSettings
last_dir = self.settings.value("last_directory", "/")
Expand Down
1 change: 1 addition & 0 deletions app/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def process_old_format(self, map_df, map_name):

def process_new_format(self, map_df, map_name):
"""Process new format wafer dataframe."""
print('The support of new data format of SEMILAB is deactivated in this SPECTROview version')
return
for i in range(0, len(map_df), 2):
coord_row = map_df.iloc[i]
Expand Down
43 changes: 43 additions & 0 deletions data_test/examples/ex_reading_all_suported_data
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import sys
import os
from pathlib import Path

from PySide6.QtWidgets import QApplication
from PySide6.QtGui import QIcon

from app.main import Main

# DATA = Path(__file__).parent / "data"

def ex_reading_all_supported_data(file_paths=None):
"""Example of reading different supported .CSV and .txt data formats"""
app = QApplication()
window = Main()
app.setStyle("Fusion")

if file_paths is not None:
window.open(file_paths=file_paths)
window.ui.show()
sys.exit(app.exec())


if __name__ == "__main__":
# DIRNAME = os.path.dirname(__file__)
# DATA = os.path.join(DIRNAME, "data_test", "example", "spectroscopic_data")
# file_path_1 = os.path.join(DATA, 'spectrum1_1ML.txt')
# file_path_2 = os.path.join(DATA, 'spectrum4_3ML.txt')
# file_path_3 = os.path.join(DATA, '2Dmap_MoS2.txt')
# file_paths = ['file_path_1', 'file_path_2', 'file_path_3']
# ex_reading_all_supported_data()

DATA_DIR = Path(__file__).parent / "spectroscopic_data"
# DATA_DIR = DIRNAME / "data_test" / "example" / "spectroscopic_data"
file_paths = [str(file) for file in DATA_DIR.glob("*.txt")]
if file_paths:
ex_reading_all_supported_data(file_paths=file_paths)
else:
print(f"No supported data files found in {DATA_DIR}")




File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions tests/test_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest

# from data_test.examples.ex_reading_all_suported_data import ex_reading_all_suported_data


def test_1():
print('test pytest')


0 comments on commit 65402f8

Please sign in to comment.