ElliotAOram / GhostPyramid

CS39440 Major project
0 stars 0 forks source link

Django setup #47

Closed ElliotAOram closed 7 years ago

ElliotAOram commented 7 years ago

Description of work

Replace android app with website and set up Django with test environment. It would be ideal to get the Django tests running on Jenkins before closing this PR

Merge criteria

Refs #46

ElliotAOram commented 7 years ago

Jenkins takes 21 second to run 3 tests which I believe is caused by the startup time of the webdriver which is created before every test. It might be faster to have this as a global variable in the test and just restart the browser to the index each time.

ElliotAOram commented 7 years ago

Jenkins Diagrams

image

ElliotAOram commented 7 years ago

Jenkins build output

Building in workspace C:\Users\User\.jenkins\workspace\pythontests
[WS-CLEANUP] Deleting project workspace...
[WS-CLEANUP] Done
Cloning the remote Git repository
Cloning repository https://github.com/ElliotAOram/GhostPyramid
 > C:/Program Files/Git/bin/git.exe. init C:\Users\User\.jenkins\workspace\pythontests # timeout=10
Fetching upstream changes from https://github.com/ElliotAOram/GhostPyramid
 > C:/Program Files/Git/bin/git.exe. --version # timeout=10
 > C:/Program Files/Git/bin/git.exe. fetch --tags --progress https://github.com/ElliotAOram/GhostPyramid +refs/heads/*:refs/remotes/origin/*
 > C:/Program Files/Git/bin/git.exe. config remote.origin.url https://github.com/ElliotAOram/GhostPyramid # timeout=10
 > C:/Program Files/Git/bin/git.exe. config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
 > C:/Program Files/Git/bin/git.exe. config remote.origin.url https://github.com/ElliotAOram/GhostPyramid # timeout=10
Fetching upstream changes from https://github.com/ElliotAOram/GhostPyramid
 > C:/Program Files/Git/bin/git.exe. fetch --tags --progress https://github.com/ElliotAOram/GhostPyramid +refs/heads/*:refs/remotes/origin/*
 > C:/Program Files/Git/bin/git.exe. rev-parse "refs/remotes/origin/46_django_setup^{commit}" # timeout=10
 > C:/Program Files/Git/bin/git.exe. rev-parse "refs/remotes/origin/origin/46_django_setup^{commit}" # timeout=10
Checking out Revision 6ecf40c83eab933c52f2368213273d1cd75f792d (refs/remotes/origin/46_django_setup)
 > C:/Program Files/Git/bin/git.exe. config core.sparsecheckout # timeout=10
 > C:/Program Files/Git/bin/git.exe. checkout -f 6ecf40c83eab933c52f2368213273d1cd75f792d
 > C:/Program Files/Git/bin/git.exe. rev-list 3cc765e7f185d826014552ef42bf75f8634d1c29 # timeout=10
[pythontests] $ cmd /c call C:\WINDOWS\TEMP\hudson2343239205350583558.bat

C:\Users\User\.jenkins\workspace\pythontests>set PYTHONPATH='C:\Python27' 

C:\Users\User\.jenkins\workspace\pythontests>pip install nose 
Requirement already satisfied: nose in c:\python27\lib\site-packages

C:\Users\User\.jenkins\workspace\pythontests>pip install pylint 
Requirement already satisfied: pylint in c:\python27\lib\site-packages
Requirement already satisfied: mccabe in c:\python27\lib\site-packages (from pylint)
Requirement already satisfied: isort>=4.2.5 in c:\python27\lib\site-packages (from pylint)
Requirement already satisfied: six in c:\python27\lib\site-packages (from pylint)
Requirement already satisfied: configparser; python_version == "2.7" in c:\python27\lib\site-packages (from pylint)
Requirement already satisfied: backports.functools-lru-cache; python_version == "2.7" in c:\python27\lib\site-packages (from pylint)
Requirement already satisfied: colorama; sys_platform == "win32" in c:\python27\lib\site-packages (from pylint)
Requirement already satisfied: astroid<1.5.0,>=1.4.5 in c:\python27\lib\site-packages (from pylint)
Requirement already satisfied: wrapt in c:\python27\lib\site-packages (from astroid<1.5.0,>=1.4.5->pylint)
Requirement already satisfied: lazy-object-proxy in c:\python27\lib\site-packages (from astroid<1.5.0,>=1.4.5->pylint)

C:\Users\User\.jenkins\workspace\pythontests>nosetests -v --with-xunit --with-coverage --cover-package=python --cover-inclusive --all-modules python/tests/ 
test_max_img_size_mt_res (python.tests.test_helper_functions.TestCalculateCropRange) ... ok
test_non_int_input (python.tests.test_helper_functions.TestCalculateCropRange) ... ok
test_non_zero_input (python.tests.test_helper_functions.TestCalculateCropRange) ... ok
test_positive_int (python.tests.test_helper_functions.TestCalculateCropRange) ... ok
test_valid_crop_range (python.tests.test_helper_functions.TestCalculateCropRange) ... ok
test_long_height_image_size (python.tests.test_helper_functions.TestCalculateImagePositions) ... ok
test_long_width_image_size (python.tests.test_helper_functions.TestCalculateImagePositions) ... ok
test_non_int_zero_negative (python.tests.test_helper_functions.TestCalculateImagePositions) ... ok
test_square_image_size (python.tests.test_helper_functions.TestCalculateImagePositions) ... ok
test_1080_display_length (python.tests.test_helper_functions.TestGetIdealImageResolution) ... ok
test_input_non_int_or_zero (python.tests.test_helper_functions.TestGetIdealImageResolution) ... ok
test_larger_than_known (python.tests.test_helper_functions.TestGetIdealImageResolution) ... ok
test_small_display_area (python.tests.test_helper_functions.TestGetIdealImageResolution) ... ok
test_correct_type_and_format (python.tests.test_helper_functions.TestGetScreenDimensions) ... ok
test_90_degree_rotation (python.tests.test_helper_functions.TestRotateImageClockwise) ... ok
test_no_rotation (python.tests.test_helper_functions.TestRotateImageClockwise) ... ok
test_height_mt_width (python.tests.test_helper_functions.TestScreenBoundaries) ... ok
test_non_int_zero_negative (python.tests.test_helper_functions.TestScreenBoundaries) ... ok
test_width_mt_height (python.tests.test_helper_functions.TestScreenBoundaries) ... ok
test_integer_zero (python.tests.test_parsers.TestIntParser) ... ok
test_negative (python.tests.test_parsers.TestIntParser) ... ok
test_non_int (python.tests.test_parsers.TestIntParser) ... ok
test_negative (python.tests.test_parsers.TestNonZeroParser) ... ok
test_positive (python.tests.test_parsers.TestNonZeroParser) ... ok
test_zero (python.tests.test_parsers.TestNonZeroParser) ... ok
test_negative (python.tests.test_parsers.TestPositiveParser) ... ok
test_positive (python.tests.test_parsers.TestPositiveParser) ... ok
test_zero (python.tests.test_parsers.TestPositiveParser) ... ok
test_begin_capture_from_webcam (python.tests.test_video_processor.TestCameraCapture) ... ok
test_begin_capture_with_non_int (python.tests.test_video_processor.TestCameraCapture) ... ok
test_end_capture_from_webcam (python.tests.test_video_processor.TestCameraCapture) ... ok
test_video_feed_initial_state (python.tests.test_video_processor.TestCameraCapture) ... ok
test_height_input (python.tests.test_video_processor.TestInitForVidoeProcessor) ... ok
test_no_input (python.tests.test_video_processor.TestInitForVidoeProcessor) ... ok
test_width_input (python.tests.test_video_processor.TestInitForVidoeProcessor) ... ok
test_close_to_resolution (python.tests.test_video_processor.TestScaleVideoFeed) ... ok
test_same_resolution_as_video (python.tests.test_video_processor.TestScaleVideoFeed) ... ok
test_scale_down_resolution (python.tests.test_video_processor.TestScaleVideoFeed) ... ok
test_up_scale_resolution (python.tests.test_video_processor.TestScaleVideoFeed) ... ok

----------------------------------------------------------------------
XML: C:\Users\User\.jenkins\workspace\pythontests\nosetests.xml
Name        Stmts   Miss  Cover
-------------------------------
python.py       0      0   100%
----------------------------------------------------------------------
Ran 39 tests in 4.229s

OK

C:\Users\User\.jenkins\workspace\pythontests>python -m coverage xml --include=python* --omit=python/vpa/run_vpa.py 

C:\Users\User\.jenkins\workspace\pythontests>pylint -f parseable -d I0011,R0801,E0401,E0611,W0403,W0401,C0412 --rcfile=.pylintrc python   1>pylint.out  & type pylint.out 

Report

======

330 statements analysed.

Statistics by type

------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |11     |11         |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|class    |13     |13         |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|method   |51     |51         |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|function |9      |9          |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+

External dependencies

---------------------

::

    cv2 (python.vpa.helper_functions,python.vpa.video_processor,python.tests.test_video_processor)

    numpy (python.vpa.video_processor,python.tests.test_helper_functions)

    python 

      \-tests 

      | \-context (python.tests.test_parsers,python.tests.test_helper_functions,python.tests.test_video_processor)

      \-vpa 

        \-helper_functions (python.vpa.video_processor)

        \-parsers (python.vpa.helper_functions,python.vpa.video_processor)

        \-video_processor (python.vpa.run_vpa)

Raw metrics

-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |378    |53.31 |378      |=          |
+----------+-------+------+---------+-----------+
|docstring |154    |21.72 |154      |=          |
+----------+-------+------+---------+-----------+
|comment   |46     |6.49  |46       |=          |
+----------+-------+------+---------+-----------+
|empty     |131    |18.48 |131      |=          |
+----------+-------+------+---------+-----------+

Duplication

-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |0     |0        |=          |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |0.000    |=          |
+-------------------------+------+---------+-----------+

Messages by category

--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |0      |0        |=          |
+-----------+-------+---------+-----------+
|refactor   |0      |0        |=          |
+-----------+-------+---------+-----------+
|warning    |0      |0        |=          |
+-----------+-------+---------+-----------+
|error      |0      |0        |=          |
+-----------+-------+---------+-----------+

Global evaluation

-----------------

Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

C:\Users\User\.jenkins\workspace\pythontests>cd charades 

C:\Users\User\.jenkins\workspace\pythontests\charades>pylint -f parseable -d I0011,R0801,E0401,E0611,W0403,W0401,C0412 --rcfile=..\.pylintrc charades   1>pylint_charades.out  & type pylint_charades.out 

Report

======

79 statements analysed.

Statistics by type

------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |8      |8          |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|class    |1      |1          |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|method   |5      |5          |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|function |4      |4          |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+

External dependencies

---------------------

::

    charades 

      \-strings (charades.views)

      \-views (charades.urls)

    django 

      \-conf 

      | \-urls (charades.urls)

      \-contrib 

      | \-admin (charades.urls)

      \-core 

      | \-wsgi (charades.wsgi)

      \-shortcuts (charades.views)

      \-test (charades.test.test_index)

    selenium 

      \-webdriver (charades.test.test_index)

Raw metrics

-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |95     |38.15 |95       |=          |
+----------+-------+------+---------+-----------+
|docstring |88     |35.34 |88       |=          |
+----------+-------+------+---------+-----------+
|comment   |16     |6.43  |16       |=          |
+----------+-------+------+---------+-----------+
|empty     |50     |20.08 |50       |=          |
+----------+-------+------+---------+-----------+

Duplication

-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |0     |0        |=          |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |0.000    |=          |
+-------------------------+------+---------+-----------+

Messages by category

--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |0      |0        |=          |
+-----------+-------+---------+-----------+
|refactor   |0      |1        |-1.00      |
+-----------+-------+---------+-----------+
|warning    |0      |1        |-1.00      |
+-----------+-------+---------+-----------+
|error      |0      |0        |=          |
+-----------+-------+---------+-----------+

Global evaluation

-----------------

Your code has been rated at 10.00/10 (previous run: 9.75/10, +0.25)

C:\Users\User\.jenkins\workspace\pythontests\charades>pip install django==1.8.13 
Requirement already satisfied: django==1.8.13 in c:\python27\lib\site-packages

C:\Users\User\.jenkins\workspace\pythontests\charades>pip install -U selenium 
Requirement already up-to-date: selenium in c:\python27\lib\site-packages

C:\Users\User\.jenkins\workspace\pythontests\charades>pip install django-jenkins 
Requirement already satisfied: django-jenkins in c:\python27\lib\site-packages
Requirement already satisfied: Django>=1.8 in c:\python27\lib\site-packages (from django-jenkins)

C:\Users\User\.jenkins\workspace\pythontests\charades>cd charades\test 

C:\Users\User\.jenkins\workspace\pythontests\charades\charades\test>python ..\..\manage.py jenkins 
...
----------------------------------------------------------------------
Ran 3 tests in 21.355s

OK
C:\Python27\lib\site-packages\django_jenkins\management\commands\jenkins.py:139: UserWarning: No PROJECT_APPS settings, coverage gathered over all apps
  warnings.warn('No PROJECT_APPS settings, coverage gathered over all apps')

Creating test database for alias 'default'...
Destroying test database for alias 'default'...
Done

C:\Users\User\.jenkins\workspace\pythontests\charades\charades\test>exit 0 
[Cobertura] Publishing Cobertura coverage report...
Publishing Cobertura coverage results...
Cobertura coverage report found.
Recording test results
Finished: SUCCESS