Skip to content

Commit

Permalink
feat: add skip for failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
UvgenGen committed Sep 15, 2022
1 parent 4b59012 commit 6ea3b94
Show file tree
Hide file tree
Showing 36 changed files with 151 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"""


from unittest import skip

from django.conf import settings
from django.core.management import call_command
from opaque_keys.edx.keys import CourseKey
from unittest import skip

from xmodule.contentstore.content import XASSET_LOCATION_TAG
from xmodule.contentstore.django import contentstore
Expand All @@ -21,7 +22,7 @@
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT


@skip("old mongo deprecated")
@skip("OldMongo Deprecation")
class ExportAllCourses(ModuleStoreTestCase):
"""
Tests assets cleanup for all courses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order


@skip("old mongo deprecated")
@skip("OldMongo Deprecation")
class ExportAllCourses(ModuleStoreTestCase):
"""
Tests exporting all courses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def test_bad_git_repos(self):
course_key,
'https://user:[email protected]/r.git')

@unittest.skip("OldMongo Deprecation")
@unittest.skipIf(os.environ.get('GIT_CONFIG') or
os.environ.get('GIT_AUTHOR_EMAIL') or
os.environ.get('GIT_AUTHOR_NAME') or
Expand Down
10 changes: 6 additions & 4 deletions cms/djangoapps/contentstore/tests/test_contentstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from functools import wraps
from json import loads
from textwrap import dedent
from unittest import SkipTest, mock
from unittest import SkipTest, mock, skip
from uuid import uuid4

import ddt
Expand All @@ -29,12 +29,11 @@
from xmodule.contentstore.django import contentstore
from xmodule.contentstore.utils import empty_asset_trashcan, restore_asset_from_trashcan
from xmodule.course_module import CourseBlock, Textbook
from xmodule.exceptions import InvalidVersionError
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.modulestore.inheritance import own_metadata
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.xml_exporter import export_course_to_xml
from xmodule.modulestore.xml_importer import import_course_from_xml, perform_xlint
from xmodule.seq_module import SequenceBlock
Expand Down Expand Up @@ -361,7 +360,8 @@ def check_import(self, root_dir, content_store, course_id):
"""Imports the course in root_dir into the given course_id and verifies its content"""
# reimport
import_course_from_xml(
self.store, self.user.id, root_dir, ['test_export'], static_content_store=content_store, target_id=course_id,
self.store, self.user.id, root_dir, ['test_export'],
static_content_store=content_store, target_id=course_id,
create_if_not_present=True
)

Expand Down Expand Up @@ -1648,6 +1648,7 @@ def test_course_handler_with_invalid_course_key_string(self):
self.assertEqual(response.status_code, 404)


@skip("OldMongo Deprecation")
class MetadataSaveTestCase(ContentStoreTestCase):
"""Test that metadata is correctly cached and decached."""

Expand Down Expand Up @@ -1989,6 +1990,7 @@ class ContentLicenseTest(ContentStoreTestCase):
Tests around content licenses
"""

@skip("OldMongo Deprecation")
def test_course_license_export(self):
content_store = contentstore()
root_dir = path(mkdtemp_clean())
Expand Down
3 changes: 2 additions & 1 deletion cms/djangoapps/contentstore/tests/test_course_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import datetime
import json
import unittest
from unittest import mock
from unittest import mock, skip
from unittest.mock import Mock, patch

import ddt
Expand Down Expand Up @@ -910,6 +910,7 @@ def setup_test_set_get_section_grader_ajax(self):
section = sections[0] # just take the first one
return reverse_usage_url('xblock_handler', section.location)

@skip("OldMongo Deprecation")
def test_set_get_section_grader_ajax(self):
"""
Test setting and getting section grades via the grade as url
Expand Down
4 changes: 4 additions & 0 deletions cms/djangoapps/contentstore/tests/test_export_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import shutil
import subprocess
from unittest import skip
from uuid import uuid4

from django.conf import settings
Expand Down Expand Up @@ -97,6 +98,7 @@ def test_exception_translation(self):
response = self.client.get(f'{self.test_url}?action=push')
self.assertNotContains(response, 'django.utils.functional.__proxy__')

@skip("OldMongo Deprecation")
def test_course_export_success(self):
"""
Test successful course export response.
Expand All @@ -106,6 +108,7 @@ def test_course_export_success(self):
response = self.client.get(f'{self.test_url}?action=push')
self.assertContains(response, 'Export Succeeded')

@skip("OldMongo Deprecation")
def test_repo_with_dots(self):
"""
Regression test for a bad directory pathing of repo's that have dots.
Expand All @@ -114,6 +117,7 @@ def test_repo_with_dots(self):
response = self.client.get(f'{self.test_url}?action=push')
self.assertContains(response, 'Export Succeeded')

@skip("OldMongo Deprecation")
def test_dirty_repo(self):
"""
Add additional items not in the repo and make sure they aren't
Expand Down
1 change: 1 addition & 0 deletions cms/djangoapps/contentstore/tests/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def _translation(domain, localedir=None, languages=None): # pylint: disable=unu
return _translation


@skip("OldMongo Deprecation")
class TestModuleI18nService(ModuleStoreTestCase):
""" Test ModuleI18nService """
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
Expand Down
5 changes: 3 additions & 2 deletions cms/djangoapps/contentstore/tests/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


import copy
from unittest import skip
from unittest.mock import patch
from uuid import uuid4

Expand Down Expand Up @@ -178,11 +179,11 @@ def test_reimport(self):
__, __, course = self.load_test_import_course(create_if_not_present=True)
self.load_test_import_course(target_id=course.id)

@skip("OldMongo Deprecation")
def test_rewrite_reference_list(self):
# FIXME
# This test fails with split modulestore (the HTML component is not in "different_course_id" namespace).
# More investigation needs to be done.
module_store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo)
module_store = modulestore()
target_id = module_store.make_course_key('testX', 'conditional_copy', 'copy_run')
import_course_from_xml(
module_store,
Expand Down
11 changes: 1 addition & 10 deletions cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from xblock.core import XBlock
from xblock.fields import String

from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.mongo.draft import as_draft
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
Expand Down Expand Up @@ -41,14 +40,6 @@ def test_import_public(self):
'set by xml'
)

@XBlock.register_temp_plugin(StubXBlock)
def test_import_draft(self):
self._assert_import(
'pure_xblock_draft',
'set by xml',
has_draft=True
)

def _assert_import(self, course_dir, expected_field_val, has_draft=False):
"""
Import a course from XML, then verify that the XBlock was loaded
Expand All @@ -66,7 +57,7 @@ def _assert_import(self, course_dir, expected_field_val, has_draft=False):
"""
# It is necessary to use the "old mongo" modulestore because split doesn't work
# with the "has_draft" logic below.
store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo) # pylint: disable=protected-access
store = modulestore()
courses = import_course_from_xml(
store, self.user.id, TEST_DATA_DIR, [course_dir], create_if_not_present=True
)
Expand Down
2 changes: 2 additions & 0 deletions cms/djangoapps/contentstore/tests/test_proctoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


from datetime import datetime, timedelta
from unittest import skip
from unittest.mock import patch

import ddt
Expand All @@ -18,6 +19,7 @@
from common.djangoapps.student.tests.factories import UserFactory


@skip("OldMongo Deprecation")
@ddt.ddt
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True})
class TestProctoredExams(ModuleStoreTestCase):
Expand Down
2 changes: 2 additions & 0 deletions cms/djangoapps/contentstore/tests/test_users_default_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
after deleting it creates same course again
"""

from unittest import skip
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase

from cms.djangoapps.contentstore.tests.utils import AjaxEnabledTestClient
Expand Down Expand Up @@ -92,6 +93,7 @@ def test_user_role_on_course_recreate(self):
# check that user has his default "Student" forum role for this course
self.assertTrue(self.user.roles.filter(name="Student", course_id=self.course_key))

@skip("OldMongo Deprecation")
def test_user_role_on_course_recreate_with_change_name_case(self):
"""
Test that creating same course again with different name case after deleting it gives user
Expand Down
3 changes: 2 additions & 1 deletion cms/djangoapps/contentstore/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" Tests for utils. """
import collections
from datetime import datetime, timedelta
from unittest import mock
from unittest import mock, skip
from unittest.mock import Mock, patch
from uuid import uuid4

Expand Down Expand Up @@ -411,6 +411,7 @@ def verify_all_components_visible_to_all():

verify_all_components_visible_to_all()

@skip("OldMongo Deprecation")
def test_sequential_and_problem_have_group_access(self):
""" Tests when group_access is set on a few different components. """
self.set_group_access(self.sequential, {1: [0]})
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.conf import settings
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.test.client import Client
from opaque_keys.edx.keys import AssetKey, CourseKey
from opaque_keys.edx.keys import AssetKey
from xmodule.contentstore.django import contentstore
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.inheritance import own_metadata
Expand Down
5 changes: 4 additions & 1 deletion cms/djangoapps/contentstore/views/tests/test_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
from datetime import datetime
from io import BytesIO
from unittest import mock
from unittest import mock, skip
from unittest.mock import patch

from ddt import data, ddt
Expand Down Expand Up @@ -73,6 +73,7 @@ def get_sample_asset(self, name, asset_type='text'):
return sample_asset


@skip("OldMongo Deprecation")
class BasicAssetsTestCase(AssetsTestCase):
"""
Test getting assets via html w/o additional args
Expand Down Expand Up @@ -439,6 +440,7 @@ def test_basic(self):
self.assertIsNone(output["thumbnail"])


@skip("OldMongo Deprecation")
class LockAssetTestCase(AssetsTestCase):
"""
Unit test for locking and unlocking an asset.
Expand Down Expand Up @@ -499,6 +501,7 @@ def post_asset_update(lock, course):
verify_asset_locked_state(False)


@skip("OldMongo Deprecation")
class DeleteAssetTestCase(AssetsTestCase):
"""
Unit test for removing an asset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import datetime
import re
from unittest import skip
from unittest.mock import Mock, patch

from django.http import Http404
Expand Down Expand Up @@ -190,19 +191,20 @@ def _create_item(self, parent_location, category, display_name, **kwargs):
**kwargs
)

@skip("OldMongo Deprecation")
def test_public_child_container_preview_html(self):
"""
Verify that a public container rendered as a child of the container page returns the expected HTML.
"""
empty_child_container = self._create_item(self.vertical.location, 'split_test', 'Split Test')
empty_child_container = self._create_item(self.vertical.location, 'split_test', 'Split Test 1')
published_empty_child_container = self.store.publish(empty_child_container.location, self.user.id)
self.validate_preview_html(published_empty_child_container, self.reorderable_child_view, can_add=False)

def test_draft_child_container_preview_html(self):
"""
Verify that a draft container rendered as a child of the container page returns the expected HTML.
"""
empty_child_container = self._create_item(self.vertical.location, 'split_test', 'Split Test')
empty_child_container = self._create_item(self.vertical.location, 'split_test', 'Split Test 1')
self.validate_preview_html(empty_child_container, self.reorderable_child_view, can_add=False)

@patch(
Expand Down
9 changes: 8 additions & 1 deletion cms/djangoapps/contentstore/views/tests/test_course_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def _assert_library_tab_present(response):
index_response = self.client.get(index_url, {}, HTTP_ACCEPT='text/html')
_assert_library_tab_present(index_response)

@skip("OldMongo Deprecation")
def test_is_staff_access(self):
"""
Test that people with is_staff see the courses and can navigate into them
Expand All @@ -115,6 +116,7 @@ def test_negative_conditions(self):
else:
self.assertEqual(response.status_code, 403)

@skip("OldMongo Deprecation")
def test_course_staff_access(self):
"""
Make and register course_staff and ensure they can access the courses
Expand Down Expand Up @@ -584,6 +586,7 @@ def _verify_deprecated_info(self, course_id, advanced_modules, info, deprecated_
reverse_course_url('advanced_settings_handler', course_id)
)

@skip("OldMongo Deprecation")
@ddt.data(
[{'publish': True}, ['notes']],
[{'publish': False}, ['notes']],
Expand All @@ -604,6 +607,7 @@ def test_verify_deprecated_warning_message(self, publish, block_types):
block_types
)

@skip("OldMongo Deprecation")
@ddt.data(
(["a", "b", "c"], ["a", "b", "c"]),
(["a", "b", "c"], ["a", "b", "d"]),
Expand Down Expand Up @@ -835,6 +839,7 @@ def test_reindex_seq_error_json_responses(self, mock_index_dictionary):
with self.assertRaises(SearchIndexingError):
reindex_course_and_check_access(self.course.id, self.user)

@skip("OldMongo Deprecation")
@mock.patch('xmodule.modulestore.mongo.base.MongoModuleStore.get_course')
def test_reindex_no_item(self, mock_get_course):
"""
Expand Down Expand Up @@ -923,6 +928,7 @@ def test_indexing_html_error_responses(self, mock_index_dictionary):
with self.assertRaises(SearchIndexingError):
CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)

@skip("OldMongo Deprecation")
@mock.patch('xmodule.seq_module.SequenceBlock.index_dictionary')
def test_indexing_seq_error_responses(self, mock_index_dictionary):
"""
Expand All @@ -945,7 +951,8 @@ def test_indexing_seq_error_responses(self, mock_index_dictionary):
with self.assertRaises(SearchIndexingError):
CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)

@mock.patch('xmodule.modulestore.mongo.base.MongoModuleStore.get_course')
@skip("OldMongo Deprecation")
@mock.patch('xmodule.modulestore.split_mongo.split.SplitMongoModuleStore.get_course')
def test_indexing_no_item(self, mock_get_course):
"""
Test system logs an error if no item found.
Expand Down
Loading

0 comments on commit 6ea3b94

Please sign in to comment.