Skip to content

Commit 440b8af

Browse files
committed
Added github action with pytest and pylint.
1 parent 092fc72 commit 440b8af

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

.github/workflows/requirements.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pylint
2+
pytest
3+
numpy
4+
selenium
5+
psutil
6+
pillow
7+
requests
8+
nested_diff
9+
dnspython
10+
monotonic
11+
tornado
12+
fonttools
13+
wsaccel
14+
xvfbwrapper
15+
ujson
16+
selenium
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
5+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
6+
7+
name: Python application
8+
9+
on:
10+
push:
11+
branches: [ master, wptaction ]
12+
pull_request:
13+
branches: [ master, wptaction ]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
build:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python 3.6.8
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: "3.6.8"
29+
cache: 'pip'
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
sudo apt-get install python3-psutil
35+
sudo apt-get install python3-xvfbwrapper
36+
sudo apt-get install python3-dnspython
37+
sudo apt-get install python3-monotonic
38+
sudo apt-get install python3-tornado
39+
sudo apt-get install python3-fonttools
40+
sudo apt-get install python3-wsaccel
41+
sudo apt-get install pylint
42+
43+
- name: Install/Cache pip dependencies
44+
run: pip install -r .github/workflows/requirements.txt
45+
46+
- name: Analysing the code with pylint
47+
run: |
48+
find -name "*.py" -not -path "./ws4py/*" -exec pylint {} --errors-only \;
49+
50+
51+
- name: Test with pytest
52+
run: |
53+
pytest -vv
54+
55+
# - name: Run a local test # We could add Local Tests here
56+
# run: |
57+
# sudo python3 wptagent.py -vvvv --location Test --xvfb --noidle --testurl 'https://www.google.com/' --testspec testspec.json --testout url --dockerized
58+
# - name: Print Profil # Call a python function to print the profile data or log data after run
59+
# run: |
60+
# python3 test_wptagent.py

wptagent_test.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import logging
2+
import pytest
3+
import warnings
4+
import os
5+
6+
def test_imports():
7+
# pylint: disable=W0611
8+
import logging
9+
import gzip
10+
import zipfile
11+
import re
12+
import traceback
13+
import psutil
14+
import glob
15+
16+
import hashlib
17+
import multiprocessing
18+
import shutil
19+
import threading
20+
21+
import gc
22+
import PIL
23+
import numpy
24+
import requests
25+
import selenium
26+
27+
import wptagent
28+
from internal.browsers import Browsers
29+
from internal.webpagetest import WebPageTest
30+
from internal.traffic_shaping import TrafficShaper
31+
from internal.adb import Adb
32+
from internal.ios_device import iOSDevice
33+
34+
35+
36+
try:
37+
import ujson as json
38+
except BaseException:
39+
warnings.warn(UserWarning("Ujson couldn't import, defaulting to json lib"))
40+
import json

0 commit comments

Comments
 (0)