Skip to content

Commit ca4623a

Browse files
Merge pull request #450 from scholarly-python-package/develop
Reorganize tests and fix failing ones
2 parents acbb1ef + fabc957 commit ca4623a

File tree

5 files changed

+414
-311
lines changed

5 files changed

+414
-311
lines changed

.github/workflows/lint.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: lint
2+
3+
on:
4+
workflow_call:
5+
push:
6+
branches: [main, develop]
7+
pull_request:
8+
branches: [main, develop]
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Set up Python 3.8
16+
uses: actions/setup-python@v3
17+
with:
18+
python-version: 3.8
19+
- name: Lint with flake8
20+
run: |
21+
pip3 install -r requirements-dev.txt
22+
# Stop the build if there are Python syntax errors, undefined names or unused imports etc.
23+
flake8
24+
# Do not stop the build, but indicate room for improvement.
25+
# exit-zero treats all errors as warnings.
26+
flake8 . --exit-zero --ignore= --select=

.github/workflows/proxytests.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package (with methods that need proxy)
5+
6+
on:
7+
workflow_run:
8+
workflows: ["lint"]
9+
branches: [main]
10+
types:
11+
- completed
12+
pull_request:
13+
branches: [main]
14+
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 180
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
python-version: [3.8]
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v3
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install dependencies
32+
run: |
33+
python3 -m pip install --upgrade pip
34+
pip3 install -r requirements-dev.txt
35+
pip3 install -r requirements.txt
36+
#- name: Typilus, Suggest Python Type Annotations
37+
# uses: typilus/typilus-action@v0.9
38+
- name: Run unittests
39+
id: unittests
40+
if: ${{ github.event.pull_request.draft == false }}
41+
continue-on-error: true
42+
env:
43+
CONNECTION_METHOD: ${{ secrets.CONNECTION_METHOD }}
44+
PASSWORD: ${{ secrets.PASSWORD }}
45+
PORT: ${{ secrets.PORT }}
46+
USERNAME: ${{ secrets.USERNAME }}
47+
SCRAPER_API_KEY: ${{ secrets.SCRAPER_API_KEY }}
48+
run: |
49+
coverage run -m unittest -v test_module.TestScholarlyWithProxy
50+
- name: Generate coverage report
51+
if:
52+
"matrix.os == 'macos-latest'"
53+
run: |
54+
curl --data-binary @.github/.codecov.yml https://codecov.io/validate | head -n 1
55+
coverage xml
56+
- name: Upload code coverage
57+
uses: codecov/codecov-action@v2
58+
with:
59+
directory: ./
60+
fail_ci_if_error: false
61+
files: ./coverage.xml
62+
flags: unittests
63+
name: codecov-umbrella
64+
verbose: true
65+
- name: Check if unittests failed
66+
if: "steps.unittests.outcome == 'failure'"
67+
run: exit 1

.github/workflows/pythonpackage.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ on:
1010
branches: [main, develop]
1111
pull_request:
1212
branches: [main, develop]
13+
workflow_run:
14+
workflows: ["lint"]
15+
# branches: [main]
16+
types:
17+
- completed
1318

1419
jobs:
20+
lint:
21+
uses: ./.github/workflows/lint.yaml
1522
build:
1623
runs-on: ${{ matrix.os }}
24+
needs: [lint]
1725
timeout-minutes: 180
1826
strategy:
1927
fail-fast: false
@@ -27,29 +35,16 @@ jobs:
2735
uses: actions/setup-python@v3
2836
with:
2937
python-version: ${{ matrix.python-version }}
30-
- name: Lint with flake8
31-
run: |
32-
pip3 install -r requirements-dev.txt
33-
# Stop the build if there are Python syntax errors, undefined names or unused imports etc.
34-
flake8
35-
# Do not stop the build, but indicate room for improvement.
36-
# exit-zero treats all errors as warnings.
37-
flake8 . --exit-zero --ignore= --select=
3838
- name: Install dependencies
3939
run: |
4040
python3 -m pip install --upgrade pip
4141
pip3 install -r requirements.txt
42+
pip3 install -r requirements-dev.txt
4243
#- name: Typilus, Suggest Python Type Annotations
4344
# uses: typilus/typilus-action@v0.9
4445
- name: Run unittests
4546
id: unittests
4647
continue-on-error: true
47-
env:
48-
CONNECTION_METHOD: ${{ secrets.CONNECTION_METHOD }}
49-
PASSWORD: ${{ secrets.PASSWORD }}
50-
PORT: ${{ secrets.PORT }}
51-
USERNAME: ${{ secrets.USERNAME }}
52-
SCRAPER_API_KEY: ${{ secrets.SCRAPER_API_KEY }}
5348
run: |
5449
coverage run -m unittest -v test_module.TestScholarly
5550
- name: Generate coverage report (macOS only)

scholarly/publication_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ def fill(self, publication: Publication)->Publication:
344344
for entry in val.find_all('a'):
345345
if entry.text.lower() == 'related articles':
346346
publication['url_related_articles'] = entry.get('href')[26:]
347+
break
347348
# number of citation per year
348349
years = [int(y.text) for y in soup.find_all(class_='gsc_oci_g_t')]
349350
cites = [int(c.text) for c in soup.find_all(class_='gsc_oci_g_al')]

0 commit comments

Comments
 (0)