Skip to content

Commit 079e8be

Browse files
Merge pull request #409 from scholarly-python-package/develop
Maintenance before v1.6.1
2 parents 868ab58 + 9d9b8cf commit 079e8be

4 files changed

Lines changed: 27 additions & 13 deletions

File tree

.github/workflows/publish-to-pypi.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Publish package to PyPI
2-
on: push
2+
on:
3+
push:
4+
branches: [main]
35

46
jobs:
57
build-n-publish:

.github/workflows/pythonpackage.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ jobs:
4343
# uses: typilus/typilus-action@v0.9
4444
- name: Install Chrome
4545
uses: browser-actions/setup-chrome@latest
46-
- name: Test with unittest
46+
continue-on-error: true
47+
with:
48+
fail_ci_if_error: false
49+
- name: Run unittests
50+
id: unittests
51+
continue-on-error: true
4752
env:
4853
CONNECTION_METHOD: ${{ secrets.CONNECTION_METHOD }}
4954
PASSWORD: ${{ secrets.PASSWORD }}
@@ -52,20 +57,23 @@ jobs:
5257
SCRAPER_API_KEY: ${{ secrets.SCRAPER_API_KEY }}
5358
run: |
5459
coverage run -m unittest -v test_module.TestScholarly
55-
coverage xml
56-
- name: Validate the repository yaml for codecov
60+
- name: Generate coverage report (macOS only)
5761
if:
58-
"matrix.os == 'ubuntu-latest'"
59-
run:
62+
"matrix.os == 'macos-latest'"
63+
run: |
6064
curl --data-binary @.github/.codecov.yml https://codecov.io/validate | head -n 1
61-
- name: Upload code coverage
65+
coverage xml
66+
- name: Upload code coverage (macOS only)
6267
if:
63-
"matrix.os != 'windows-latest'"
68+
"matrix.os == 'macos-latest'"
6469
uses: codecov/codecov-action@v2
6570
with:
6671
directory: ./
67-
fail_ci_if_error: true
72+
fail_ci_if_error: false
6873
files: ./coverage.xml
6974
flags: unittests
7075
name: codecov-umbrella
7176
verbose: true
77+
- name: Check if unittests failed
78+
if: "steps.unittests.outcome == 'failure'"
79+
run: exit 1

scholarly/_proxy_generator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __init__(self):
4949
self._tor_control_port = None
5050
self._tor_password = None
5151
self._session = None
52+
self._webdriver = None
5253
self._TIMEOUT = 5
5354
self._new_session()
5455

@@ -458,7 +459,10 @@ def _close_session(self):
458459
if self._session:
459460
self._session.close()
460461
if self._webdriver:
461-
self._webdriver.quit()
462+
try:
463+
self._webdriver.quit()
464+
except Exception as e:
465+
self.logger.warning("Could not close webdriver cleanly: %s", e)
462466

463467
def _fp_coroutine(self, timeout=1, wait_time=120):
464468
"""A coroutine to continuosly yield free proxies

test_module.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def test_search_author_id_filled(self):
347347
self.assertGreaterEqual(len(author['publications']), 179)
348348
pub = author['publications'][1]
349349
self.assertEqual(pub["citedby_url"],
350-
"https://scholar.google.com/scholar?oi=bibs&hl=en&cites=6983837810323809551")
350+
"https://scholar.google.com/scholar?oi=bibs&hl=en&cites=9976400141451962702")
351351

352352
@unittest.skipIf(os.getenv("CONNECTION_METHOD") in {None, "none", "freeproxy"}, reason="No robust proxy setup")
353353
def test_search_pubs(self):
@@ -658,8 +658,8 @@ def test_download_mandates_csv(self):
658658
}
659659
agency_2020 = {
660660
"US National Science Foundation": "86%",
661-
"Department of Science & Technology, India": "47%",
662-
"Swedish Research Council": "88%",
661+
"Department of Science & Technology, India": "48%",
662+
"Swedish Research Council": "89%",
663663
"Swedish Research Council for Environment, Agricultural Sciences and Spatial Planning": "88%"
664664
}
665665

0 commit comments

Comments
 (0)