diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..1a68748d --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,58 @@ +# Python package +# Create and test a Python package on multiple Python versions. +# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/python + +trigger: +- master + +jobs: + +- job: 'Test' + pool: + vmImage: 'Ubuntu-16.04' + strategy: + matrix: + Python27: + python.version: '2.7' + Python35: + python.version: '3.5' + Python36: + python.version: '3.6' + Python37: + python.version: '3.7' + maxParallel: 4 + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + architecture: 'x64' + + - script: python -m pip install --upgrade pip && pip install -r libs/requirements.txt + displayName: 'Install dependencies' + + - script: | + pip install pytest + pytest tests --doctest-modules --junitxml=junit/test-results.xml + displayName: 'pytest' + + - task: PublishTestResults@2 + inputs: + testResultsFiles: '**/test-results.xml' + testRunTitle: 'Python $(python.version)' + condition: succeededOrFailed() + +- job: 'Publish' + dependsOn: 'Test' + pool: + vmImage: 'Ubuntu-16.04' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.x' + architecture: 'x64' + + - script: python setup.py sdist + displayName: 'Build sdist' diff --git a/tests/general.py b/tests/general.py deleted file mode 100755 index ddcc7aa0..00000000 --- a/tests/general.py +++ /dev/null @@ -1,72 +0,0 @@ -#! /usr/bin/env python2 -from __future__ import print_function - -import datetime -import os -import sys - -import core -from core import logger, main_db, transcoder -from core.auto_process import comics, games, movies, music, tv -from core.auto_process.common import ProcessResult -from core.user_scripts import external_script -from core.forks import auto_fork -from core.utils import char_replace, clean_dir, convert_to_ascii, extract_files, get_dirs, get_download_info, get_nzoid, plex_update, update_download_info_status, server_responding - - -# Initialize the config -core.initialize() - -# label = core.TORRENT_CLASS.core.get_torrent_status('f33a9c4b15cbd9170722d700069af86746817ade', ['label']).get()['label'] -# print(label) - -if transcoder.is_video_good(core.TEST_FILE, 0): - print('FFPROBE Works') -else: - print('FFPROBE FAILED') - -test = core.CFG['SickBeard', 'NzbDrone']['tv'].isenabled() -print(test) -section = core.CFG.findsection('tv').isenabled() -print(section) -print(len(section)) -fork, fork_params = auto_fork('SickBeard', 'tv') - -if server_responding('http://127.0.0.1:5050'): - print('CouchPotato Running') -if server_responding('http://127.0.0.1:7073'): - print('SickBeard Running') -if server_responding('http://127.0.0.1:8181'): - print('HeadPhones Running') -if server_responding('http://127.0.0.1:8085'): - print('Gamez Running') -if server_responding('http://127.0.0.1:8090'): - print('Mylar Running') - -lan = 'pt' -lan = Language.fromalpha2(lan) -print(lan.alpha3) -vidName = '/volume1/Public/Movies/A Few Good Men/A Few Good Men(1992).mkv' -inputName = 'in.the.name.of.ben.hur.2016.bdrip.x264-rusted.nzb' -guess = guessit.guessit(inputName) -if guess: - # Movie Title - title = None - if 'title' in guess: - title = guess['title'] - # Movie Year - year = None - if 'year' in guess: - year = guess['year'] - url = 'http://www.omdbapi.com' - r = requests.get(url, params={'y': year, 't': title}, verify=False, timeout=(60, 300)) - results = r.json() - print(results) - -subliminal.region.configure('dogpile.cache.dbm', arguments={'filename': 'cachefile.dbm'}) -languages = set() -languages.add(lan) -video = subliminal.scan_video(vidName) -subtitles = subliminal.download_best_subtitles({video}, languages) -subliminal.save_subtitles(video, subtitles[video]) -del core.MYAPP diff --git a/tests/test_initialize.py b/tests/test_initialize.py new file mode 100755 index 00000000..8985f84a --- /dev/null +++ b/tests/test_initialize.py @@ -0,0 +1,33 @@ +#! /usr/bin/env python +from __future__ import print_function + +import datetime +import os +import sys +sys.path.extend(["..","."]) + +import eol +eol.check() + +import cleanup +cleanup.clean(cleanup.FOLDER_STRUCTURE) + +import core +from core import logger, main_db +from core.auto_process import comics, games, movies, music, tv +from core.auto_process.common import ProcessResult +from core.plugins.downloaders.nzb.utils import get_nzoid +from core.plugins.plex import plex_update +from core.user_scripts import external_script +from core.utils import ( + char_replace, clean_dir, convert_to_ascii, + extract_files, get_dirs, get_download_info, + update_download_info_status, +) + +# Initialize the config +core.initialize() +del core.MYAPP + +def test_answer(): + assert core.CHECK_MEDIA == 1