tmpdir = local('/tmp/pytest-of-root/pytest-4/test_find_best_subtitles_match0') def test_find_best_subtitles_matches(tmpdir): movie_filename = str( (tmpdir / 'Parks.and.Recreation.S05E13.HDTV.x264-LOL.avi').ensure()) with patch('ss.ServerProxy', autospec=True) as rpc_mock: with patch('ss.calculate_hash_for_file', autospec=True) as hash_mock: hash_mock.return_value = '13ab' rpc_mock.return_value = server = MagicMock(name='MockServer') server.LogIn.return_value = dict(token='TOKEN') server.SearchSubtitles.return_value = { 'data': [ # OpenSubtitles returned wrong Season: should be skipped dict( MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.x264-LOL.srt', SubDownloadsCnt='1000', SubDownloadLink='http://sub99.srt', SubFormat='srt', SeriesSeason='4', SeriesEpisode='13', ), # OpenSubtitles returned wrong Episode: should be skipped dict( MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.x264-LOL.srt', SubDownloadsCnt='1000', SubDownloadLink='http://sub98.srt', SubFormat='srt', SeriesSeason='5', SeriesEpisode='11', ), # First with correct season and episode: winner dict( MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.x264-LOL.srt', SubDownloadsCnt='1000', SubDownloadLink='http://sub1.srt', SubFormat='srt', SeriesSeason='5', SeriesEpisode='13', ), dict( MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.x264-LOL.srt', SubDownloadsCnt=1500, SubDownloadLink='http://sub2.srt', SubFormat='srt', SeriesSeason='5', SeriesEpisode='13', ), dict( MovieReleaseName='Parks.and.Recreation.S05E13.HDTV.-LOL.srt', SubDownloadsCnt=9999, SubDownloadLink='http://sub3.srt', SubFormat='srt', SeriesSeason='5', SeriesEpisode='13', ), ] } > result = ss.find_subtitle(movie_filename, 'en') tests/test_ss.py:182: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ss.py:99: in find_subtitle search_results = query_open_subtitles(movie_filename, language) ss.py:81: in query_open_subtitles guessit_query = obtain_guessit_query(movie_filename, language) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ movie_filename = '/tmp/pytest-of-root/pytest-4/test_find_best_subtitles_match0/Parks.and.Recreation.S05E13.HDTV.x264-LOL.avi' language = 'en' def obtain_guessit_query(movie_filename, language): > guess = guessit.guess_file_info(os.path.basename(movie_filename), info=['filename']) E AttributeError: module 'guessit' has no attribute 'guess_file_info' ss.py:27: AttributeError