From 33a8dd795376ce537802e31990cfd9f5645e161a Mon Sep 17 00:00:00 2001 From: Fernando Wittmann Date: Wed, 15 Nov 2023 23:08:34 -0300 Subject: [PATCH] Fix test file and add tests on github actions --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ .gitignore | 4 ++++ test/test_sortgs.py | 6 +++--- 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b878c57 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 diff --git a/.gitignore b/.gitignore index ee23b39..6f63f05 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,7 @@ ipython_config.py # Environments .env .venv + +# Other variables +.DS_Store +.vscode/ \ No newline at end of file diff --git a/test/test_sortgs.py b/test/test_sortgs.py index a4b0ee5..e95744e 100644 --- a/test/test_sortgs.py +++ b/test/test_sortgs.py @@ -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):