You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":"docs","path":"docs","contentType":"directory"},{"name":"src","path":"src","contentType":"directory"},{"name":"tests","path":"tests","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".travis.yml","path":".travis.yml","contentType":"file"},{"name":"LICENSE.txt","path":"LICENSE.txt","contentType":"file"},{"name":"MANIFEST.in","path":"MANIFEST.in","contentType":"file"},{"name":"README.rst","path":"README.rst","contentType":"file"},{"name":"TESTING.txt","path":"TESTING.txt","contentType":"file"},{"name":"check_rst.sh","path":"check_rst.sh","contentType":"file"},{"name":"discover_tests.py","path":"discover_tests.py","contentType":"file"},{"name":"futurize.py","path":"futurize.py","contentType":"file"},{"name":"pasteurize.py","path":"pasteurize.py","contentType":"file"},{"name":"pytest.ini","path":"pytest.ini","contentType":"file"},{"name":"requirements_py26.txt","path":"requirements_py26.txt","contentType":"file"},{"name":"setup.py","path":"setup.py","contentType":"file"}],"totalCount":16}},"fileTreeProcessingTime":1.821684,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":78335095,"defaultBranch":"master","name":"python-future","ownerLogin":"mhils","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2017-01-08T10:06:57.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/1019198?v=4","public":true,"private":false,"isOrgOwned":false},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1494079526.0","canEdit":false,"refType":"branch","currentOid":"ecf112163ce9aaa7715c1d777a79e1c66d509e8f"},"path":"discover_tests.py","currentUser":null,"blob":{"rawLines":["\"\"\"","Simple auto test discovery.","","From http://stackoverflow.com/a/17004409","\"\"\"","import os","import sys","import unittest","","if not hasattr(unittest.defaultTestLoader, 'discover'):"," try:"," import unittest2 as unittest"," except ImportError:"," raise ImportError('The unittest2 module is required to run tests on Python 2.6')","","def additional_tests():"," setup_file = sys.modules['__main__'].__file__"," setup_dir = os.path.abspath(os.path.dirname(setup_file))"," test_dir = os.path.join(setup_dir, 'tests')"," test_suite = unittest.defaultTestLoader.discover(test_dir)"," blacklist = []"," if '/home/travis' in __file__:"," # Skip some tests that fail on travis-ci"," blacklist.append('test_command')"," return exclude_tests(test_suite, blacklist)","","","class SkipCase(unittest.TestCase):"," def skeleton_run_test(self):"," raise unittest.SkipTest(\"Test fails spuriously on travis-ci\")","","","def exclude_tests(suite, blacklist):"," \"\"\""," Example:"," "," blacklist = ["," 'test_some_test_that_should_be_skipped',"," 'test_another_test_that_should_be_skipped'"," ]"," \"\"\""," new_suite = unittest.TestSuite()"," "," for test_group in suite._tests:"," for test in test_group:"," if not hasattr(test, '_tests'):"," # e.g. ModuleImportFailure"," new_suite.addTest(test)"," continue"," for subtest in test._tests:"," method = subtest._testMethodName"," if method in blacklist:"," setattr(test,"," method,"," getattr(SkipCase(), 'skeleton_run_test'))"," new_suite.addTest(test)"," return new_suite"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/mhils/python-future/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"discover_tests.py","displayUrl":"https://github.com/mhils/python-future/blob/master/discover_tests.py?raw=true","headerInfo":{"blobSize":"1.66 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":"https://desktop.github.com","isGitLfs":false,"onBranch":true,"shortPath":"9f2e581","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fmhils%2Fpython-future%2Fblob%2Fmaster%2Fdiscover_tests.py","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"58","truncatedSloc":"48"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Python","languageID":303,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/mhils/python-future/blob/master/discover_tests.py","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/mhils/python-future/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/mhils/python-future/raw/refs/heads/master/discover_tests.py","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"additional_tests","kind":"function","ident_start":336,"ident_end":352,"extent_start":332,"extent_end":769,"fully_qualified_name":"additional_tests","ident_utf16":{"start":{"line_number":15,"utf16_col":4},"end":{"line_number":15,"utf16_col":20}},"extent_utf16":{"start":{"line_number":15,"utf16_col":0},"end":{"line_number":24,"utf16_col":47}}},{"name":"SkipCase","kind":"class","ident_start":778,"ident_end":786,"extent_start":772,"extent_end":909,"fully_qualified_name":"SkipCase","ident_utf16":{"start":{"line_number":27,"utf16_col":6},"end":{"line_number":27,"utf16_col":14}},"extent_utf16":{"start":{"line_number":27,"utf16_col":0},"end":{"line_number":29,"utf16_col":69}}},{"name":"skeleton_run_test","kind":"function","ident_start":815,"ident_end":832,"extent_start":811,"extent_end":909,"fully_qualified_name":"SkipCase.skeleton_run_test","ident_utf16":{"start":{"line_number":28,"utf16_col":8},"end":{"line_number":28,"utf16_col":25}},"extent_utf16":{"start":{"line_number":28,"utf16_col":4},"end":{"line_number":29,"utf16_col":69}}},{"name":"exclude_tests","kind":"function","ident_start":916,"ident_end":929,"extent_start":912,"extent_end":1694,"fully_qualified_name":"exclude_tests","ident_utf16":{"start":{"line_number":32,"utf16_col":4},"end":{"line_number":32,"utf16_col":17}},"extent_utf16":{"start":{"line_number":32,"utf16_col":0},"end":{"line_number":56,"utf16_col":20}}}]}},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"csrf_tokens":{"/mhils/python-future/branches":{"post":"nFoVKZtja3wSRVX3zd-kf3yVqoC6MZOSgF0mE8VRv4jBNurgUOf-QD8moWV2IbomyoMq83BAdPuY2sq1wG9N8g"},"/repos/preferences":{"post":"GausHqZ-oQCvXWIXvf_1gfVsRuOfYnOzxJq8Jl4Xx4har0OQMnfK70b8Z16DEHFxhAluKuyoPCOD21dNBzWEdg"}}},"title":"python-future/discover_tests.py at master · mhils/python-future","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}