-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from lanl/testing_CI
Created CI files for backend and plugin files on the open
- Loading branch information
Showing
10 changed files
with
203 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: file_reader test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
|
||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install pyyaml | ||
pip install toml | ||
pip install . | ||
- name: Test reader | ||
run: | | ||
pip install pytest | ||
pytest dsi/plugins/tests/test_file_reader.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: file_writer test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install pyyaml | ||
pip install toml | ||
pip install . | ||
- name: Test reader | ||
run: | | ||
pip install pytest | ||
pytest dsi/plugins/tests/test_file_writer.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: test_plugin.py test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
python -m pip install opencv-python | ||
pip install pyyaml | ||
pip install toml | ||
pip install . | ||
pip install graphviz | ||
sudo apt-get install graphviz | ||
- name: Test reader | ||
run: | | ||
pip install pytest | ||
pytest dsi/tests/test_plugin.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: sqlite.py test | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install pyyaml | ||
pip install toml | ||
pip install . | ||
- name: Test reader | ||
run: | | ||
pip install pytest | ||
pytest dsi/backends/tests/test_sqlite.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,17 @@ | ||
from dsi.plugins import file_writer as fw | ||
import cv2 | ||
import sqlite3 | ||
import numpy as np | ||
import subprocess | ||
import os | ||
|
||
def test_export_db_erd(): | ||
|
||
connection = sqlite3.connect("test.db") | ||
cursor = connection.cursor() | ||
cursor.execute("CREATE TABLE IF NOT EXISTS example (id INTEGER, name TEXT, age INTEGER)") | ||
cursor.execute("INSERT INTO example VALUES (1, 'alice', 20)") | ||
cursor.execute("INSERT INTO example VALUES (2, 'bob', 30)") | ||
cursor.execute("INSERT INTO example VALUES (3, 'eve', 40)") | ||
connection.commit() | ||
connection.close() | ||
|
||
er_image = cv2.imread("test1.png") | ||
pixel_mean = np.mean(er_image) | ||
|
||
subprocess.run(["sqlite3", "erd_test.db"], stdin= open("examples/data/erd_test.sql", "r")) | ||
fw.ER_Diagram("erd_test.db").export_erd("erd_test.db", "erd_test_output") | ||
os.remove("erd_test.db") | ||
|
||
er_image = cv2.imread("erd_test_output.png") | ||
assert er_image is not None #check if image generated at all | ||
os.remove("test1.png") | ||
|
||
pixel_mean = np.mean(er_image) | ||
os.remove("erd_test_output.png") | ||
assert pixel_mean != 255 #check if image is all white pixels (no diagram generated) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
-- Create the `publishers` table | ||
CREATE TABLE publishers ( | ||
publisher_id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
name TEXT NOT NULL, | ||
address TEXT | ||
); | ||
|
||
-- Create the `authors` table | ||
CREATE TABLE authors ( | ||
author_id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
name TEXT NOT NULL, | ||
birth_date DATE | ||
); | ||
|
||
-- Create the `books` table | ||
CREATE TABLE books ( | ||
book_id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
title TEXT NOT NULL, | ||
publish_date DATE, | ||
publisher_id INTEGER, | ||
author_id INTEGER, | ||
FOREIGN KEY (publisher_id) REFERENCES publishers(publisher_id), | ||
FOREIGN KEY (author_id) REFERENCES authors(author_id) | ||
); | ||
|
||
-- Insert some sample data into `publishers` | ||
INSERT INTO publishers (name, address) VALUES | ||
('Penguin Random House', 'New York, NY'), | ||
('HarperCollins', 'New York, NY'); | ||
|
||
-- Insert some sample data into `authors` | ||
INSERT INTO authors (name, birth_date) VALUES | ||
('J.K. Rowling', '1965-07-31'), | ||
('George R.R. Martin', '1948-09-20'); | ||
|
||
-- Insert some sample data into `books` | ||
INSERT INTO books (title, publish_date, publisher_id, author_id) VALUES | ||
('Harry Potter and the Philosophers Stone', '1997-06-26', 1, 1), | ||
('A Game of Thrones', '1996-08-06', 2, 2); |