mirror of https://github.com/Bunsly/JobSpy
enh: test on pr (#174)
parent
60d4d911c9
commit
8678b0bbe4
|
@ -0,0 +1,22 @@
|
||||||
|
name: Python Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.8'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
pip install poetry
|
||||||
|
poetry install
|
||||||
|
- name: Run tests
|
||||||
|
run: poetry run pytest src/tests/
|
|
@ -0,0 +1,2 @@
|
||||||
|
[virtualenvs]
|
||||||
|
in-project = true
|
|
@ -5,10 +5,10 @@ import pandas as pd
|
||||||
def test_all():
|
def test_all():
|
||||||
result = scrape_jobs(
|
result = scrape_jobs(
|
||||||
site_name=["linkedin", "indeed", "zip_recruiter", "glassdoor"],
|
site_name=["linkedin", "indeed", "zip_recruiter", "glassdoor"],
|
||||||
search_term="software engineer",
|
search_term="engineer",
|
||||||
results_wanted=5,
|
results_wanted=5,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
isinstance(result, pd.DataFrame) and not result.empty
|
isinstance(result, pd.DataFrame) and len(result) == 20
|
||||||
), "Result should be a non-empty DataFrame"
|
), "Result should be a non-empty DataFrame"
|
||||||
|
|
|
@ -2,10 +2,12 @@ from ..jobspy import scrape_jobs
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
|
||||||
def test_indeed():
|
def test_glassdoor():
|
||||||
result = scrape_jobs(
|
result = scrape_jobs(
|
||||||
site_name="glassdoor", search_term="software engineer", country_indeed="USA"
|
site_name="glassdoor",
|
||||||
|
search_term="engineer",
|
||||||
|
results_wanted=5,
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
isinstance(result, pd.DataFrame) and not result.empty
|
isinstance(result, pd.DataFrame) and len(result) == 5
|
||||||
), "Result should be a non-empty DataFrame"
|
), "Result should be a non-empty DataFrame"
|
||||||
|
|
|
@ -4,8 +4,10 @@ import pandas as pd
|
||||||
|
|
||||||
def test_indeed():
|
def test_indeed():
|
||||||
result = scrape_jobs(
|
result = scrape_jobs(
|
||||||
site_name="indeed", search_term="software engineer", country_indeed="usa"
|
site_name="indeed",
|
||||||
|
search_term="engineer",
|
||||||
|
results_wanted=5,
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
isinstance(result, pd.DataFrame) and not result.empty
|
isinstance(result, pd.DataFrame) and len(result) == 5
|
||||||
), "Result should be a non-empty DataFrame"
|
), "Result should be a non-empty DataFrame"
|
||||||
|
|
|
@ -3,10 +3,7 @@ import pandas as pd
|
||||||
|
|
||||||
|
|
||||||
def test_linkedin():
|
def test_linkedin():
|
||||||
result = scrape_jobs(
|
result = scrape_jobs(site_name="linkedin", search_term="engineer", results_wanted=5)
|
||||||
site_name="linkedin",
|
|
||||||
search_term="software engineer",
|
|
||||||
)
|
|
||||||
assert (
|
assert (
|
||||||
isinstance(result, pd.DataFrame) and not result.empty
|
isinstance(result, pd.DataFrame) and len(result) == 5
|
||||||
), "Result should be a non-empty DataFrame"
|
), "Result should be a non-empty DataFrame"
|
||||||
|
|
|
@ -4,10 +4,9 @@ import pandas as pd
|
||||||
|
|
||||||
def test_ziprecruiter():
|
def test_ziprecruiter():
|
||||||
result = scrape_jobs(
|
result = scrape_jobs(
|
||||||
site_name="zip_recruiter",
|
site_name="zip_recruiter", search_term="software engineer", results_wanted=5
|
||||||
search_term="software engineer",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
isinstance(result, pd.DataFrame) and not result.empty
|
isinstance(result, pd.DataFrame) and len(result) == 5
|
||||||
), "Result should be a non-empty DataFrame"
|
), "Result should be a non-empty DataFrame"
|
||||||
|
|
Loading…
Reference in New Issue