forked from mie-lab/trackintel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_tutorial.py
41 lines (32 loc) · 996 Bytes
/
test_tutorial.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
import pandas as pd
import geopandas as gpd
import trackintel as ti
import subprocess
import pytest
@pytest.fixture(scope="function")
def change_test_dir():
"""Change the current working directory, run the function and change back."""
os.chdir("./examples")
yield
os.chdir("..")
class Test_tutorial:
"""Tests for tutorial jupyter notebook."""
def test_basic_tutorial(self, change_test_dir):
"""Test if the tutorial jupyter notebook runs without errors."""
# convert the jupyter notebook to .py file
args = [
"jupyter",
"nbconvert",
"./trackintel_basic_tutorial.ipynb",
"--output",
"tempFile",
"--to",
"script",
"--execute",
"--ExecutePreprocessor.timeout=360",
]
# check if the .py file runs without error
subprocess.check_call(args)
# remove the .py file
os.remove("tempFile.py")