Skip to content

Testing in python 2 and 3

Steve edited this page Jan 31, 2018 · 9 revisions

Install python

$ brew install python python3
$ git clone https://github.com/siznax/wptools.git
$ cd wptools

Test in python2

$ mkvirtualenv --python=`which python2` wptools
[wptools]$ pip install --upgrade pip
[wptools]$ pip install -r requirements.txt
[wptools]$ pip install nose
[wptools]$ nosetests tests/test_basic.py
Ran 58 tests in 0.844s

OK

Test in python3

$ mkvirtualenv --python=`which python3` wptools_py3
[wptools_py3]$ pip install --upgrade pip
[wptools_py3]$ pip install -r requirements.txt
[wptools_py3]$ pip install nose
[wptools_py3]$ nosetests tests/test_basic.py
Ran 58 tests in 0.507s

OK

Advanced tests

A small number of tests with random lang, title input.

$ python tests/test_advanced.py

Stress testing

New features should be stress tested.

python tests/stress.py

We get a random language (from over 100 choices) and get a random title from the Wikipedia of that language and do a get(), forever...

$ python tests/stress.py
WPTOOLS STRESS TEST Thu Dec  7 18:55:46 2017 delay: 3 lang: 110 pages: +
========================================================================
Python 3.6.3 (default, Oct  4 2017, 06:09:38)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
------------------------------------------------------------------------
[1] 7 1.4 https://mg.wikipedia.org/wiki/Beaulieu,_Ardèche
Q317367 44.3617°N 4.2344°E / 44.3617; 4.2344I **Beaulieu, Ardèche** dia
[2] 7 1.1 https://sr.wikipedia.org/wiki/Владан_Дујовић
Q16086434 **Владан Дујовић** (Пећ, 15. јун 1963) је српски позоришни, теле
[3] 6 1.1 https://ca.wikipedia.org/wiki/Manna_(desambiguació)
Q409872 « **Manna** » té aquests significats:  * **Mannà** , aliment env
[4] 7 1.0 https://el.wikipedia.org/wiki/Σαμόα_Τζο
Q381825 Ο **Νουφολάου Τζόελ Σενόα** ( _Nuufolau Joel "Joe" Seanoa_ , 17
[5] 6 1.0 https://da.wikipedia.org/wiki/660'erne_f.Kr.
Q664639 Århundreder: 8. århundrede f.Kr. – **7\. århundrede f.Kr.** – 6.
[6] 6 1.0 https://he.wikipedia.org/wiki/אהרן_קאהן
Q6574261 הרב **אהרן הכהן קאהן** (נולד ה'תשכ"ו) הוא ראש ישיבת **תולדות אבר
[7] 6 0.9 https://cy.wikipedia.org/wiki/Rissa
Q2154820 Arlunydd benywaidd o'r Almaen yw **Rissa** (22 Mehefin 1938).Tre
[8] 7 0.9 https://eu.wikipedia.org/wiki/Bougival
Q399342 **Bougival** Frantziako udalerria da, Yvelines departamenduan da
Note: Wikidata item Q2247326 missing 'instance of' (P31)
[9] 6 0.9 https://cy.wikipedia.org/wiki/Rhyfel_cyfyngedig
Q2247326 Rhyfel lle mae'r cydryfelwyr yn osgoi grym diarbed yn fwriadol y
[10] 7 0.9 https://ur.wikipedia.org/wiki/قارامای
Q658240 **قارامای** ( لاطینی: Karamay) چین کا ایک پریفیکچر سطح شہر جو سن
Clone this wiki locally