Skip to content

Commit 71e4ccf

Browse files
Merge pull request #525 from dlebedinsky/develop
Fixed test_bibtex unit test, updated CONTRIBUTING.md
2 parents 568d4ad + ba3b8a4 commit 71e4ccf

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

.github/CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ Additionally, if you are interesting in contributing to the codebase, submit a p
1616

1717
## How to contribute
1818

19-
1. Create a fork of `scholarly-python-package/scholarly` repository.
20-
2. If you add a new feature, try to include tests in already existing test cases, or create a new test case if that is not possible.
21-
3. Make sure the unit tests pass before raising a PR. For all the unit tests to pass, you typically need to setup a premium proxy service such as `ScraperAPI` or `Luminati` (`Bright Data`). If you do not have an account, you may try to use `FreeProxy`. Without a proxy, 6 out of 17 test cases will be skipped.
22-
4. Check that the documentatation is consistent with the code. Check that the documentation builds successfully.
23-
5. Submit a PR, with `develop` as your base branch.
24-
6. After an initial code review by the maintainers, the unit tests will be run with the `ScraperAPI` key stored in the Github repository. Passing all tests cases is necessary before merging your PR.
19+
1. Create a fork of `scholarly-python-package/scholarly` repository. Make sure that "Copy the main branch only" is **not** checked off.
20+
2. After cloning your fork and checking out into the develop branch, run `python setup.py --help-commands` for more info on how to install dependencies and build. You may need to run it with `sudo`.
21+
3. If you add a new feature, try to include tests in already existing test cases, or create a new test case if that is not possible. For a comprehensive output, run `python -m unittest -v test_module.py`
22+
4. Make sure the unit tests pass before raising a PR. For all the unit tests to pass, you typically need to setup a premium proxy service such as `ScraperAPI` or `Luminati` (`Bright Data`). By default, `python setup.py install` will get `FreeProxy`. Without a proxy, 6 out of 17 test cases will be skipped.
23+
5. Check that the documentatation is consistent with the code. Check that the documentation builds successfully.
24+
6. Submit a PR, with `develop` as your base branch.
25+
7. After an initial code review by the maintainers, the unit tests will be run with the `ScraperAPI` key stored in the Github repository. Passing all tests cases is necessary before merging your PR.
2526

2627

2728
## Build Docs

test_module.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ def test_tor_launch_own_process(self):
7878
authors = [a for a in scholarly.search_author(query)]
7979
self.assertGreaterEqual(len(authors), 1)
8080

81+
class TestFreeProxy(unittest.TestCase):
82+
luminati = os.getenv("USERNAME") and os.getenv("PASSWORD") and os.getenv("PORT")
83+
scraperAPI = os.getenv('SCRAPER_API_KEY')
84+
skipIf = (luminati is not None) or (scraperAPI is not None)
85+
86+
@unittest.skipIf(skipIf, reason="Other proxy is being used")
87+
def test_freeproxy(self):
88+
"""
89+
Test that we can set up FreeProxy successfully
90+
"""
91+
proxy_generator = ProxyGenerator()
92+
success = proxy_generator.FreeProxies()
93+
self.assertTrue(success)
94+
self.assertEqual(proxy_generator.proxy_mode, "FREE_PROXIES")
8195

8296
class TestScholarly(unittest.TestCase):
8397

@@ -690,7 +704,7 @@ def test_bibtex(self):
690704
Test that we get the BiBTeX entry correctly
691705
"""
692706

693-
with open("testdata/bibtex.txt", "r") as f:
707+
with open("testdata/test_bibtex_result.txt", "r") as f:
694708
expected_result = "".join(f.readlines())
695709

696710
pub = scholarly.search_single_pub("A distribution-based clustering algorithm for mining in large "

0 commit comments

Comments
 (0)