diff --git a/docs/topics/development/debugging.rst b/docs/topics/development/debugging.rst index db8fd3a449..d34977ef2b 100644 --- a/docs/topics/development/debugging.rst +++ b/docs/topics/development/debugging.rst @@ -46,13 +46,13 @@ All being well it should look like this:: """) :/opt/rh/python27/root/usr/lib/python2.7/site-packages/celery/utils/__init__.py:93 - > /code/apps/browse/views.py(148)themes() + > /code/src/olympia/browse/views.py(148)themes() 147 import ipdb;ipdb.set_trace() --> 148 TYPE = amo.ADDON_THEME 149 if category is not None: ipdb> n - > /code/apps/browse/views.py(149)themes() + > /code/src/olympia/browse/views.py(149)themes() 148 TYPE = amo.ADDON_THEME --> 149 if category is not None: 150 q = Category.objects.filter(application=request.APP.id, type=TYPE) diff --git a/docs/topics/development/testing.rst b/docs/topics/development/testing.rst index 3ae1443d6a..dafdeeed9a 100644 --- a/docs/topics/development/testing.rst +++ b/docs/topics/development/testing.rst @@ -69,7 +69,7 @@ To fail and stop running tests on the first failure:: If you wish to add arguments, or run a specific test, overload the variables (check the Makefile for more information):: - make test ARGS='-v apps/amo/tests/test_url_prefix.py::MiddlewareTest::test_get_app' + make test ARGS='-v src/olympia/amo/tests/test_url_prefix.py::MiddlewareTest::test_get_app' If you wish to re-run only the tests failed from the previous run:: diff --git a/docs/topics/development/tests.rst b/docs/topics/development/tests.rst index 3dcf4b2456..57fb397b91 100644 --- a/docs/topics/development/tests.rst +++ b/docs/topics/development/tests.rst @@ -17,7 +17,7 @@ methods: * `py.test -m es_tests` to run the tests that are marked_ as `es_tests` * `py.test -k test_no_license` to run all the tests that have `test_no_license` in their name -* `py.test apps/addons/tests/test_views.py::TestLicensePage::test_no_license` +* `py.test src/olympia/addons/tests/test_views.py::TestLicensePage::test_no_license` to run only this specific test You'll find more documentation on this on the `Pytest usage documentation`_. diff --git a/src/olympia/addons/templates/addons/includes/button_data_attributes.html b/src/olympia/addons/templates/addons/includes/button_data_attributes.html index 925f73aad3..613abdd3ff 100644 --- a/src/olympia/addons/templates/addons/includes/button_data_attributes.html +++ b/src/olympia/addons/templates/addons/includes/button_data_attributes.html @@ -1,6 +1,6 @@ {# these are custom attributes on
found in - # apps/addons/templates/addons/impala/button.html and - # apps/addons/templates/addons/mobile/button.html #} + # src/olympia/addons/templates/addons/impala/button.html and + # src/olympia/addons/templates/addons/mobile/button.html #} data-addon="{{ addon.id }}" data-icon="{{ addon.icon_url }}" data-developers="{{ addon.meet_the_dev_url() }}" diff --git a/src/olympia/amo/tests/__init__.py b/src/olympia/amo/tests/__init__.py index af29c4fc72..1e907771fb 100644 --- a/src/olympia/amo/tests/__init__.py +++ b/src/olympia/amo/tests/__init__.py @@ -564,7 +564,7 @@ class AMOPaths(object): """Mixin for getting common AMO Paths.""" def file_fixture_path(self, name): - path = 'apps/files/fixtures/files/%s' % name + path = 'src/olympia/files/fixtures/files/%s' % name return os.path.join(settings.ROOT, path) def xpi_path(self, name): diff --git a/src/olympia/api/tests/test_oauth.py b/src/olympia/api/tests/test_oauth.py index f7ad377674..9da1b63a22 100644 --- a/src/olympia/api/tests/test_oauth.py +++ b/src/olympia/api/tests/test_oauth.py @@ -316,7 +316,7 @@ class TestAddon(BaseOAuth): def setUp(self): super(TestAddon, self).setUp() - path = 'apps/files/fixtures/files/extension.xpi' + path = 'src/olympia/files/fixtures/files/extension.xpi' xpi = os.path.join(settings.ROOT, path) f = open(xpi) @@ -326,7 +326,7 @@ class TestAddon(BaseOAuth): platform='mac', xpi=f) - path = 'apps/files/fixtures/files/extension-0.2.xpi' + path = 'src/olympia/files/fixtures/files/extension-0.2.xpi' self.version_data = dict(builtin=2, platform='windows', xpi=open(os.path.join(settings.ROOT, path))) self.update_data = dict(name='fu', @@ -591,7 +591,7 @@ class TestAddon(BaseOAuth): a = Addon.objects.get(pk=id) v = a.versions.get() eq_(v.version, '0.1') - return a, v, 'apps/files/fixtures/files/extension-0.2.xpi' + return a, v, 'src/olympia/files/fixtures/files/extension-0.2.xpi' def test_update_version_no_license(self): a, v, path = self.create_for_update() diff --git a/src/olympia/devhub/tests/test_tasks.py b/src/olympia/devhub/tests/test_tasks.py index f912812c6a..aa697382e9 100644 --- a/src/olympia/devhub/tests/test_tasks.py +++ b/src/olympia/devhub/tests/test_tasks.py @@ -150,7 +150,7 @@ class TestValidator(TestCase): self.upload.update( path=os.path.join(settings.ROOT, - 'apps/devhub/tests/addons/desktop.xpi')) + 'src/olympia/devhub/tests/addons/desktop.xpi')) assert self.upload.validation is None diff --git a/src/olympia/devhub/tests/test_utils.py b/src/olympia/devhub/tests/test_utils.py index bd9c96a801..e89e124401 100644 --- a/src/olympia/devhub/tests/test_utils.py +++ b/src/olympia/devhub/tests/test_utils.py @@ -442,7 +442,7 @@ class TestValidationAnnotatorBase(TestCase): # Create a FileUpload object for an XPI containing version 1.1. path = os.path.join(settings.ROOT, - 'apps/devhub/tests/addons/desktop.xpi') + 'src/olympia/devhub/tests/addons/desktop.xpi') self.file_upload = FileUpload.objects.create(path=path) self.xpi_version = '1.1' diff --git a/src/olympia/devhub/tests/test_views_validation.py b/src/olympia/devhub/tests/test_views_validation.py index d8a20c6bcc..566c815900 100644 --- a/src/olympia/devhub/tests/test_views_validation.py +++ b/src/olympia/devhub/tests/test_views_validation.py @@ -57,7 +57,7 @@ class TestUploadValidation(BaseUploadTest): eq_(doc('td').text(), 'December 6, 2010') def test_upload_processed_validation(self): - addon_file = open('apps/files/fixtures/files/validation-error.xpi') + addon_file = open('src/olympia/files/fixtures/files/validation-error.xpi') response = self.client.post(reverse('devhub.upload'), {'name': 'addon.xpi', 'upload': addon_file}) @@ -405,7 +405,7 @@ class TestUploadURLs(TestCase): FileUpload.objects.all().delete() self.run_validator.reset_mock() - with open('apps/files/fixtures/files/validation-error.xpi') as file_: + with open('src/olympia/files/fixtures/files/validation-error.xpi') as file_: resp = self.client.post(reverse(view, kwargs=kw), {'upload': file_}) assert resp.status_code == 302 diff --git a/src/olympia/files/tests/test_helpers.py b/src/olympia/files/tests/test_helpers.py index da2a8441be..eb2f9aa866 100644 --- a/src/olympia/files/tests/test_helpers.py +++ b/src/olympia/files/tests/test_helpers.py @@ -19,7 +19,7 @@ from olympia.files.helpers import FileViewer, DiffHelper from olympia.files.models import File from olympia.files.utils import SafeUnzip -root = os.path.join(settings.ROOT, 'apps/files/fixtures/files') +root = os.path.join(settings.ROOT, 'src/olympia/files/fixtures/files') def get_file(filename): diff --git a/src/olympia/files/tests/test_models.py b/src/olympia/files/tests/test_models.py index 4ec19cd948..dcfc082a3d 100644 --- a/src/olympia/files/tests/test_models.py +++ b/src/olympia/files/tests/test_models.py @@ -356,7 +356,7 @@ class TestParseXpi(TestCase): version=version) def parse(self, addon=None, filename='extension.xpi'): - path = 'apps/files/fixtures/files/' + filename + path = 'src/olympia/files/fixtures/files/' + filename xpi = os.path.join(settings.ROOT, path) return parse_addon(open(xpi), addon) @@ -1158,7 +1158,7 @@ def test_parse_addon(search_mock, xpi_mock): def test_parse_xpi(): """Fire.fm can sometimes give us errors. Let's prevent that.""" firefm = os.path.join(settings.ROOT, - 'apps/files/fixtures/files/firefm.xpi') + 'src/olympia/files/fixtures/files/firefm.xpi') rdf = parse_xpi(open(firefm)) eq_(rdf['name'], 'Fire.fm') diff --git a/src/olympia/files/tests/test_tasks.py b/src/olympia/files/tests/test_tasks.py index 5d1b3cfa26..a9368226f5 100644 --- a/src/olympia/files/tests/test_tasks.py +++ b/src/olympia/files/tests/test_tasks.py @@ -12,7 +12,7 @@ from olympia.versions.models import Version # Very basic js file that contains a `let`, a `const`, and a `var` in the # toplevel scope. Both the `let` and `const` should be rewritten to `var`. -TEST_JS_FILE = 'apps/files/fixtures/files/test_with_toplevel_let.js' +TEST_JS_FILE = 'src/olympia/files/fixtures/files/test_with_toplevel_let.js' def assert_test_file_fixed(filename): @@ -48,7 +48,7 @@ def test_fix_let_scope_bustage_in_xpi(mock_fixer): The two files that should be fixed are some_file.js and foobar/main.js. Both those files have the same content as the TEST_JS_FILE. """ - test_xpi = 'apps/files/fixtures/files/extension-let-global-scope.xpi' + test_xpi = 'src/olympia/files/fixtures/files/extension-let-global-scope.xpi' with amo.tests.copy_file_to_temp(test_xpi) as temp_filename: tasks.fix_let_scope_bustage_in_xpi(temp_filename) mock_fixer.assert_called_once_with(mock.ANY, mock.ANY) @@ -74,7 +74,7 @@ def test_fix_let_scope_bustage_in_addon(mock_sign_file, mock_version_bump, assert addon.versions.count() == 2 # Two versions, we only fix the last. # Assign a file for the last version's file. - test_xpi = 'apps/files/fixtures/files/extension-let-global-scope.xpi' + test_xpi = 'src/olympia/files/fixtures/files/extension-let-global-scope.xpi' file_ = File.objects.create(version=version, filename='foo.xpi', is_signed=True) with override_settings(PRELIMINARY_SIGNING_SERVER='prelim_signing'): diff --git a/src/olympia/files/tests/test_utils_.py b/src/olympia/files/tests/test_utils_.py index 247b651aae..149254d120 100644 --- a/src/olympia/files/tests/test_utils_.py +++ b/src/olympia/files/tests/test_utils_.py @@ -419,7 +419,7 @@ class TestManifestJSONExtractor(TestCase): def test_zip_folder_content(): - extension_file = 'apps/files/fixtures/files/extension.xpi' + extension_file = 'src/olympia/files/fixtures/files/extension.xpi' try: temp_folder = utils.extract_zip(extension_file) assert os.listdir(temp_folder) == [ @@ -439,7 +439,7 @@ def test_zip_folder_content(): def test_repack(): # Warning: context managers all the way down. Because they're awesome. - extension_file = 'apps/files/fixtures/files/extension.xpi' + extension_file = 'src/olympia/files/fixtures/files/extension.xpi' # We don't want to overwrite our fixture, so use a copy. with amo.tests.copy_file_to_temp(extension_file) as temp_filename: # This is where we're really testing the repack helper. @@ -468,7 +468,7 @@ def file_obj(): def test_bump_version_in_install_rdf(file_obj): - with amo.tests.copy_file('apps/files/fixtures/files/jetpack.xpi', + with amo.tests.copy_file('src/olympia/files/fixtures/files/jetpack.xpi', file_obj.file_path): utils.update_version_number(file_obj, '1.3.1-signed') parsed = utils.parse_xpi(file_obj.file_path) @@ -476,7 +476,7 @@ def test_bump_version_in_install_rdf(file_obj): def test_bump_version_in_alt_install_rdf(file_obj): - with amo.tests.copy_file('apps/files/fixtures/files/alt-rdf.xpi', + with amo.tests.copy_file('src/olympia/files/fixtures/files/alt-rdf.xpi', file_obj.file_path): utils.update_version_number(file_obj, '2.1.106.1-signed') parsed = utils.parse_xpi(file_obj.file_path) @@ -485,7 +485,7 @@ def test_bump_version_in_alt_install_rdf(file_obj): def test_bump_version_in_package_json(file_obj): with amo.tests.copy_file( - 'apps/files/fixtures/files/new-format-0.0.1.xpi', + 'src/olympia/files/fixtures/files/new-format-0.0.1.xpi', file_obj.file_path): utils.update_version_number(file_obj, '0.0.1.1-signed') parsed = utils.parse_xpi(file_obj.file_path) diff --git a/src/olympia/files/tests/test_views.py b/src/olympia/files/tests/test_views.py index d1ba3f5ff4..c02f276806 100644 --- a/src/olympia/files/tests/test_views.py +++ b/src/olympia/files/tests/test_views.py @@ -22,8 +22,8 @@ from olympia.files.helpers import DiffHelper, FileViewer from olympia.files.models import File from olympia.users.models import UserProfile -dictionary = 'apps/files/fixtures/files/dictionary-test.xpi' -unicode_filenames = 'apps/files/fixtures/files/unicode-filenames.xpi' +dictionary = 'src/olympia/files/fixtures/files/dictionary-test.xpi' +unicode_filenames = 'src/olympia/files/fixtures/files/unicode-filenames.xpi' not_binary = 'install.js' binary = 'dictionaries/ar.dic' diff --git a/src/olympia/lib/crypto/tests.py b/src/olympia/lib/crypto/tests.py index ecb0a51885..6809d99af7 100644 --- a/src/olympia/lib/crypto/tests.py +++ b/src/olympia/lib/crypto/tests.py @@ -218,7 +218,7 @@ class TestPackaged(TestCase): assert packaged.is_signed(self.file_.file_path) def test_sign_file_multi_package(self): - with amo.tests.copy_file('apps/files/fixtures/files/multi-package.xpi', + with amo.tests.copy_file('src/olympia/files/fixtures/files/multi-package.xpi', self.file_.file_path, overwrite=True): self.file_.update(is_multi_package=True) self.assert_not_signed() @@ -323,7 +323,7 @@ class TestTasks(TestCase): """Don't bump nor sign unreviewed files.""" for status in (amo.UNREVIEWED_STATUSES + (amo.STATUS_BETA,)): self.file_.update(status=amo.STATUS_UNREVIEWED) - with amo.tests.copy_file('apps/files/fixtures/files/jetpack.xpi', + with amo.tests.copy_file('src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): file_hash = self.file_.generate_hash() assert self.version.version == '1.3' @@ -344,10 +344,10 @@ class TestTasks(TestCase): backup_file2_path = u'{0}.backup_signature'.format( self.file2.file_path) try: - with amo.tests.copy_file('apps/files/fixtures/files/jetpack.xpi', + with amo.tests.copy_file('src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): with amo.tests.copy_file( - 'apps/files/fixtures/files/jetpack.xpi', + 'src/olympia/files/fixtures/files/jetpack.xpi', self.file2.file_path): file_hash = self.file_.generate_hash() file2_hash = self.file2.generate_hash() @@ -372,7 +372,7 @@ class TestTasks(TestCase): """Use the full signing server if files are fully reviewed.""" self.file_.update(status=amo.STATUS_PUBLIC) with amo.tests.copy_file( - 'apps/files/fixtures/files/jetpack.xpi', + 'src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): tasks.sign_addons([self.addon.pk]) mock_sign_file.assert_called_with( @@ -383,7 +383,7 @@ class TestTasks(TestCase): """Use the prelim signing server if files aren't fully reviewed.""" self.file_.update(status=amo.STATUS_LITE) with amo.tests.copy_file( - 'apps/files/fixtures/files/jetpack.xpi', + 'src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): tasks.sign_addons([self.addon.pk]) mock_sign_file.assert_called_with( @@ -400,7 +400,7 @@ class TestTasks(TestCase): assert file_hash == self.file_.generate_hash() self.assert_no_backup() - with amo.tests.copy_file('apps/files/fixtures/files/jetpack.xpi', + with amo.tests.copy_file('src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): file_hash = self.file_.generate_hash() assert self.version.version == '1.3' @@ -428,7 +428,7 @@ class TestTasks(TestCase): """Sign files which have non-ascii filenames.""" self.file_.update(filename=u'jétpack.xpi') with amo.tests.copy_file( - 'apps/files/fixtures/files/jetpack.xpi', + 'src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): file_hash = self.file_.generate_hash() assert self.version.version == '1.3' @@ -446,7 +446,7 @@ class TestTasks(TestCase): """Sign versions which have non-ascii version numbers.""" self.version.update(version=u'é1.3') with amo.tests.copy_file( - 'apps/files/fixtures/files/jetpack.xpi', + 'src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): file_hash = self.file_.generate_hash() assert self.version.version == u'é1.3' @@ -463,7 +463,7 @@ class TestTasks(TestCase): def test_sign_bump_old_versions_default_compat(self, mock_sign_file): """Sign files which are old, but default to compatible.""" with amo.tests.copy_file( - 'apps/files/fixtures/files/jetpack.xpi', + 'src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): file_hash = self.file_.generate_hash() assert self.version.version == '1.3' @@ -481,7 +481,7 @@ class TestTasks(TestCase): def test_sign_bump_new_versions_not_default_compat(self, mock_sign_file): """Sign files which are recent, event if not default to compatible.""" with amo.tests.copy_file( - 'apps/files/fixtures/files/jetpack.xpi', + 'src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): file_hash = self.file_.generate_hash() assert self.version.version == '1.3' @@ -499,7 +499,7 @@ class TestTasks(TestCase): @mock.patch('lib.crypto.tasks.sign_file') def test_dont_resign_dont_bump_version_in_model(self, mock_sign_file): with amo.tests.copy_file( - 'apps/files/fixtures/files/new-addon-signature.xpi', + 'src/olympia/files/fixtures/files/new-addon-signature.xpi', self.file_.file_path): self.file_.update(is_signed=True) file_hash = self.file_.generate_hash() @@ -530,7 +530,7 @@ class TestTasks(TestCase): @mock.patch('lib.crypto.tasks.sign_file') def test_dont_sign_dont_bump_sign_error(self, mock_sign_file): mock_sign_file.side_effect = IOError() - with amo.tests.copy_file('apps/files/fixtures/files/jetpack.xpi', + with amo.tests.copy_file('src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): file_hash = self.file_.generate_hash() assert self.version.version == '1.3' @@ -546,7 +546,7 @@ class TestTasks(TestCase): @mock.patch('lib.crypto.tasks.sign_file') def test_dont_bump_not_signed(self, mock_sign_file): mock_sign_file.return_value = None # Pretend we didn't sign. - with amo.tests.copy_file('apps/files/fixtures/files/jetpack.xpi', + with amo.tests.copy_file('src/olympia/files/fixtures/files/jetpack.xpi', self.file_.file_path): file_hash = self.file_.generate_hash() assert self.version.version == '1.3' @@ -562,7 +562,7 @@ class TestTasks(TestCase): @mock.patch('lib.crypto.tasks.sign_file') def test_resign_bump_version_in_model_if_force(self, mock_sign_file): with amo.tests.copy_file( - 'apps/files/fixtures/files/new-addon-signature.xpi', + 'src/olympia/files/fixtures/files/new-addon-signature.xpi', self.file_.file_path): self.file_.update(is_signed=True) file_hash = self.file_.generate_hash() diff --git a/src/olympia/signing/tests/test_views.py b/src/olympia/signing/tests/test_views.py index ecb33209ef..51c265d5ff 100644 --- a/src/olympia/signing/tests/test_views.py +++ b/src/olympia/signing/tests/test_views.py @@ -167,7 +167,7 @@ class TestUploadVersion(BaseUploadVersionCase): assert not qs.exists() response = self.put( addon=guid, version='0.1', - filename='apps/files/fixtures/files/experiment.xpi') + filename='src/olympia/files/fixtures/files/experiment.xpi') assert response.status_code == 201 assert qs.exists() addon = qs.get() @@ -183,7 +183,7 @@ class TestUploadVersion(BaseUploadVersionCase): assert not qs.exists() response = self.put( addon=guid, version='0.1', - filename='apps/files/fixtures/files/experiment.xpi') + filename='src/olympia/files/fixtures/files/experiment.xpi') assert response.status_code == 400 assert response.data['error'] == ( 'You cannot submit this type of add-on') diff --git a/src/olympia/stats/tests/test_commands.py b/src/olympia/stats/tests/test_commands.py index 77f121331c..626e1a9054 100644 --- a/src/olympia/stats/tests/test_commands.py +++ b/src/olympia/stats/tests/test_commands.py @@ -17,7 +17,7 @@ from olympia.stats.models import DownloadCount, ThemeUpdateCount, UpdateCount from olympia.zadmin.models import DownloadSource -hive_folder = os.path.join(settings.ROOT, 'apps/stats/fixtures/files') +hive_folder = os.path.join(settings.ROOT, 'src/olympia/stats/fixtures/files') class FixturesFolderMixin(object): diff --git a/tox.ini b/tox.ini index 315a85e24f..161f923575 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ envlist = es, addons-devhub-editors, main, flake8, docs, assets basepython = python2.7 install_command = pip install --no-deps --exists-action=w --find-links https://pyrepo.stage.mozaws.net/wheelhouse/ --find-links https://pyrepo.stage.mozaws.net/ --no-index {opts} {packages} setenv = - PYTHONPATH=apps + PYTHONPATH=src whitelist_externals = make npm @@ -23,12 +23,12 @@ commands = [testenv:addons-devhub-editors] deps = {[base]deps} commands = - py.test --create-db -n 3 -m 'not es_tests' -v apps/addons/ apps/devhub/ apps/editors/ {posargs} + py.test --create-db -n 3 -m 'not es_tests' -v src/olympia/addons/ src/olympia/devhub/ src/olympia/editors/ {posargs} [testenv:main] deps = {[base]deps} commands = - py.test --create-db -n 3 -m 'not es_tests' -v --ignore apps/addons/ --ignore apps/devhub/ --ignore apps/editors/ {posargs} + py.test --create-db -n 3 -m 'not es_tests' -v --ignore src/olympia/addons/ --ignore src/olympia/devhub/ --ignore src/olympia/editors/ {posargs} [testenv:assets] deps = {[base]deps}