Skip to content

Commit

Permalink
Fix test file and add tests on github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
WittmannF committed Nov 16, 2023
1 parent 182c7ef commit 33a8dd7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Test SortGS

on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with unittest
run: python -m unittest
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ ipython_config.py
# Environments
.env
.venv

# Other variables
.DS_Store
.vscode/
6 changes: 3 additions & 3 deletions test/test_sortgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class TestSortGS(unittest.TestCase):
@classmethod
def setUpClass(self):
'''run once before all tests'''
os.system("python sortgs.py --debug --kw 'machine learning' --nresults 10")
os.system("python sortgs.py --debug --kw 'machine learning' --nresults 10 --endyear 2022")
self.df_top_10=pd.read_csv('machine_learning.csv')

os.system("python sortgs.py --debug --kw 'machine learning' --nresults 20")
os.system("python sortgs.py --debug --kw 'machine learning' --nresults 20 --endyear 2022")
self.df_top_20=pd.read_csv('machine_learning.csv')

os.system("python sortgs.py --debug --kw 'machine learning' --nresults 20 --sortby 'cit/year'")
os.system("python sortgs.py --debug --kw 'machine learning' --nresults 20 --endyear 2022 --sortby 'cit/year'")
self.df_top_sorted_cit_per_year=pd.read_csv('machine_learning.csv')

def test_get_10_results(self):
Expand Down

0 comments on commit 33a8dd7

Please sign in to comment.