File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ """
2+ Module for testing the scrape graph class
3+ """
4+
5+ import os
6+ import pytest
7+ import pandas as pd
8+ from dotenv import load_dotenv
9+ from scrapegraphai .graphs import ScrapeGraph
10+ from scrapegraphai .utils import prettify_exec_info
11+
12+ load_dotenv ()
13+
14+ @pytest .fixture
15+ def graph_config ():
16+ """Configuration of the graph"""
17+ openai_key = os .getenv ("OPENAI_APIKEY" )
18+ return {
19+ "llm" : {
20+ "api_key" : openai_key ,
21+ "model" : "openai/gpt-3.5-turbo" ,
22+ },
23+ "verbose" : True ,
24+ "headless" : False ,
25+ }
26+
27+ def test_scraping_pipeline (graph_config ):
28+ """Start of the scraping pipeline"""
29+ scrape_graph = ScrapeGraph (
30+ source = "https://perinim.github.io/projects/" ,
31+ config = graph_config ,
32+ )
33+
34+ result = scrape_graph .run ()
35+
36+ assert result is not None
37+ assert isinstance (result , list )
38+
39+ def test_get_execution_info (graph_config ):
40+ """Get the execution info"""
41+ scrape_graph = ScrapeGraph (
42+ source = "https://perinim.github.io/projects/" ,
43+ config = graph_config ,
44+ )
45+
46+ scrape_graph .run ()
47+
48+ graph_exec_info = scrape_graph .get_execution_info ()
49+
50+ assert graph_exec_info is not None
You can’t perform that action at this time.
0 commit comments