diff --git a/.travis.yml b/.travis.yml index bf097b13..91834dec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ python: - "2.6" - "2.7" install: "pip install -r requirements.txt --use-mirrors" -script: python tests.py \ No newline at end of file +script: python setup.py test \ No newline at end of file diff --git a/README.rst b/README.rst index 094a08df..d357db71 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ http://www.dejacode.org/about_spec_v0.8.0.html REQUIREMENTS ------------ -The ABOUT tool has been tested with Python 2.6 or 2.7 on Linux, Mac and Windows. +The ABOUT tool is tested with Python 2.6 or 2.7 on Linux, Mac and Windows. You will need to install a Python interpreter if you do not have one already installed. @@ -63,7 +63,7 @@ https://github.com/dejacode/about-code-tool/archive/master.zip Then open a terminal or command prompt, extract the download if needed and run:: - python tests.py + python setup.py test USAGE diff --git a/about.ABOUT b/about.ABOUT index 32d2c9b3..89b7ad3b 100644 --- a/about.ABOUT +++ b/about.ABOUT @@ -1,4 +1,4 @@ -about_resource: . +about_resource: about-code-tool/about.py name: ABOUT tool version: 0.8.1 @@ -14,9 +14,9 @@ changelog_file: CHANGELOG.txt vcs_tool: git vcs_repository: https://github.com/dejacode/about-code-tool.git -description: This is a tool to process ABOUT files. An ABOUT file provides a - simple way to document the provenance (origin and license) 'about' a software - component. An ABOUT file is a small text file stored in the codebase +description: This is a tool to process ABOUT files. An ABOUT file provides a + simple way to document the provenance (origin and license) 'about' a software + component. An ABOUT file is a small text file stored in the codebase side-by-side with the software component that it documents. @@ -35,4 +35,3 @@ notice: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - diff --git a/MAPPING.CONFIG b/about_code_tool/MAPPING.CONFIG similarity index 100% rename from MAPPING.CONFIG rename to about_code_tool/MAPPING.CONFIG diff --git a/about_code_tool/__init__.py b/about_code_tool/__init__.py new file mode 100644 index 00000000..661a7f93 --- /dev/null +++ b/about_code_tool/__init__.py @@ -0,0 +1,12 @@ +# ============================================================================= +# Copyright (c) 2013 by nexB, Inc. http://www.nexb.com/ - All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================= diff --git a/about.py b/about_code_tool/about.py similarity index 99% rename from about.py rename to about_code_tool/about.py index 01ab782d..c6e05f8a 100644 --- a/about.py +++ b/about_code_tool/about.py @@ -553,7 +553,7 @@ def license_text(self): license_text_path = self.file_fields_locations["license_text_file"] with open(license_text_path, 'rU') as f: return f.read() - except Exception as e: + except Exception as e: pass #return empty string if the license file does not exist return "" @@ -567,7 +567,7 @@ def notice_text(self): notice_text_path = self.file_fields_locations["notice_file"] with open(notice_text_path, 'rU') as f: return f.read() - except Exception as e: + except Exception as e: pass #return empty string if the notice file does not exist return "" @@ -1015,21 +1015,21 @@ def generate_attribution(self, template_path='templates/default.html', return # We only need the fields names and values to render the template - about_validated_fields = [about_object.validated_fields - for about_object in self.about_objects - if not sublist + about_validated_fields = [about_object.validated_fields + for about_object in self.about_objects + if not sublist or about_object.about_resource_path in sublist] - about_license_text = [about_object.license_text() - for about_object in self.about_objects - if not sublist + about_license_text = [about_object.license_text() + for about_object in self.about_objects + if not sublist or about_object.about_resource_path in sublist] about_notice_text = [about_object.notice_text() for about_object in self.about_objects if not sublist or about_object.about_resource_path in sublist] - return template.render(about_objects = about_validated_fields, + return template.render(about_objects = about_validated_fields, license_texts = about_license_text, notice_texts = about_notice_text) diff --git a/genabout.py b/about_code_tool/genabout.py similarity index 94% rename from genabout.py rename to about_code_tool/genabout.py index a42fa96d..d5087ca3 100644 --- a/genabout.py +++ b/about_code_tool/genabout.py @@ -42,8 +42,10 @@ Warn = namedtuple('Warn', 'field_name field_value message',) Error = namedtuple('Error', 'field_name field_value message',) +self_path = abspath(dirname(__file__)) + + class GenAbout(object): - def __init__(self): self.warnings = [] self.errors = [] @@ -93,7 +95,6 @@ def read_input(self, input_file, mapping): components_list.append(file_list) return components_list - @staticmethod def config_mapping(mapping): about_resource = 'about_resource' @@ -102,7 +103,7 @@ def config_mapping(mapping): version = 'version' if mapping: try: - with open('MAPPING.CONFIG', "rU") as file_in: + with open(join(self_path, 'MAPPING.CONFIG'), "rU") as file_in: for line in file_in.readlines(): if not line.startswith('#'): if line.partition(':')[0] == 'about_resource': @@ -129,7 +130,6 @@ def config_mapping(mapping): else: return about_resource, about_file, name, version - def verify_license_files(self, input_list, project_path): """ Verify the existence of the 'license text file' @@ -162,7 +162,6 @@ def verify_license_files(self, input_list, project_path): sys.exit(errno.EINVAL) return output_list - def copy_license_files(self, gen_location, license_list): """ copy the 'license_text_file' into the gen_location @@ -177,14 +176,11 @@ def copy_license_files(self, gen_location, license_list): makedirs(license_parent_dir) shutil.copy2(license_path, output_license_path) - """ - def extract_licesen_from_url(self): - # This function needs discussion - test = urllib2.urlopen("https://enterprise.dejacode.com/license_library/Demo/gpl-1.0/#license-text") - with open('testdata/test_file.txt', 'wb') as output_file: - output_file.write(test.read()) - """ - + #def extract_license_from_url(self): + # # This function needs discussion + # test = urllib2.urlopen("https://enterprise.dejacode.com/license_library/Demo/gpl-1.0/#license-text") + # with open('testdata/test_file.txt', 'wb') as output_file: + # output_file.write(test.read()) def pre_generation(self, gen_location, input_list, action_num, all_in_one): """ @@ -234,28 +230,22 @@ def pre_generation(self, gen_location, input_list, action_num, all_in_one): output_list.append(component_list) return output_list - - def format_output(self, input_list): + @staticmethod + def format_output(input_list): """ - process the input and covert to the specific strings format + Process the input and convert to the specific strings format. """ components_list = [] - for items in input_list: + for entry in input_list: + about_file_location = entry[0] + about_dict_list = entry[1] + component = [] - about_file_location = items[0] - about_dict_list = items[1] - context = '' - if about_dict_list['name']: - name = about_dict_list['name'] - else: - name = '' - if about_dict_list['version']: - version = about_dict_list['version'] - else: - version = '' - context = 'about_resource: ' + about_dict_list['about_resource'] + '\n' \ - + 'name: ' + name + '\n' \ - + 'version: ' + version + '\n\n' + component_name = about_dict_list.get('name', '') + component_version = about_dict_list.get('version', '') + context = 'about_resource: %s\nname: %s\nversion: %s\n\n' % ( + about_dict_list['about_resource'], component_name, component_version) + for item in sorted(about_dict_list.iterkeys()): if item == 'about_file': continue @@ -265,12 +255,12 @@ def format_output(self, input_list): value = about_dict_list[item].replace('\n', '\n ') if (value or item in MANDATORY_FIELDS) and not item in SKIPPED_FIELDS: context += item + ': ' + value + '\n' + component.append(about_file_location) component.append(context) components_list.append(component) return components_list - def write_output(self, output): for line in output: about_file_location = line[0] @@ -280,7 +270,6 @@ def write_output(self, output): with open(about_file_location, 'wb') as output_file: output_file.write(context) - def warnings_errors_summary(self, gen_location, show_error_num): display_error = False display_warning = False diff --git a/genattrib.py b/about_code_tool/genattrib.py similarity index 100% rename from genattrib.py rename to about_code_tool/genattrib.py diff --git a/templates/default.html b/about_code_tool/templates/default.html similarity index 100% rename from templates/default.html rename to about_code_tool/templates/default.html diff --git a/about_code_tool/tests/__init__.py b/about_code_tool/tests/__init__.py new file mode 100644 index 00000000..661a7f93 --- /dev/null +++ b/about_code_tool/tests/__init__.py @@ -0,0 +1,12 @@ +# ============================================================================= +# Copyright (c) 2013 by nexB, Inc. http://www.nexb.com/ - All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================= diff --git a/tests.py b/about_code_tool/tests/test_about.py similarity index 87% rename from tests.py rename to about_code_tool/tests/test_about.py index 493967e2..bd473638 100644 --- a/tests.py +++ b/about_code_tool/tests/test_about.py @@ -14,6 +14,7 @@ # limitations under the License. # ============================================================================= +from __future__ import print_function from __future__ import with_statement import os @@ -22,8 +23,11 @@ from StringIO import StringIO import tempfile import unittest +from os.path import abspath, dirname, join -import about +from about_code_tool import about + +TESTDATA_PATH = join(abspath(dirname(__file__)), 'testdata') class BasicTest(unittest.TestCase): @@ -37,27 +41,29 @@ def test_simple_about_command_line_can_run(self): shutil.rmtree(tst_fn, ignore_errors=True) def test_return_path_is_not_abspath_and_contains_subdirs_on_file(self): - test_input = "testdata/thirdparty/django_snippets_2413.ABOUT" - test_output = "testdata/output/test_return_path_is_not_abspath_on_file.csv" + # Using a relative path for the purpose of this test + test_input = "about_code_tool/tests/testdata/thirdparty/django_snippets_2413.ABOUT" + test_output = join(TESTDATA_PATH, 'output/test_return_path_is_not_abspath_on_file.csv') try: os.remove(test_output) except OSError: pass collector = about.AboutCollector(test_input, test_output, '0') collector.extract_about_info() - self.assertTrue(open(test_output).read().partition('\n')[2].startswith('testdata/thirdparty/django_snippets_2413.ABOUT')) + self.assertTrue(open(test_output).read().partition('\n')[2].startswith('about_code_tool/tests/testdata/thirdparty/django_snippets_2413.ABOUT')) os.remove(test_output) def test_return_path_is_not_abspath_and_contains_subdirs_on_dir(self): - test_input = "testdata/basic" - test_output = "testdata/output/test_return_path_is_not_abspath_on_dir.csv" + # Using a relative path for the purpose of this test + test_input = "about_code_tool/tests/testdata/basic" + test_output = join(TESTDATA_PATH, 'output/test_return_path_is_not_abspath_on_dir.csv') try: os.remove(test_output) except OSError: pass collector = about.AboutCollector(test_input, test_output, '0') collector.extract_about_info() - self.assertTrue(open(test_output).read().partition('\n')[2].startswith('testdata/basic')) + self.assertTrue(open(test_output).read().partition('\n')[2].startswith('about_code_tool/tests/testdata/basic')) os.remove(test_output) def test_isvalid_about_file(self): @@ -221,21 +227,19 @@ def test_pre_process_with_spaces_left_of_colon(self): self.assertEqual(expected, result.read()) def test_handles_last_line_is_a_continuation_line(self): - about_obj = about.AboutFile() warnings = [] warn = about.AboutFile.check_line_continuation(" Last line is a continuation line.", True) warnings.append(warn) self.assertTrue(warnings == [""], "This should not throw any warning.") def test_handles_last_line_is_not_a_continuation_line(self): - about_obj = about.AboutFile() warnings = [] warn = about.AboutFile.check_line_continuation(" Last line is NOT a continuation line.", False) warnings.append(warn) self.assertTrue(len(warnings) == 1, "This should throw ONLY 1 warning.") def test_normalize_dupe_field_names(self): - about_file = about.AboutFile('testdata/parser_tests/dupe_field_name.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'parser_tests/dupe_field_name.ABOUT')) expected_warnings = [about.IGNORED, 'Apache HTTP Server'] self.assertTrue(len(about_file.warnings) == 1, "This should throw one warning") for w in about_file.warnings: @@ -243,7 +247,7 @@ def test_normalize_dupe_field_names(self): self.assertEqual(expected_warnings[1], w.field_value) def test_normalize_lowercase(self): - about_file = about.AboutFile('testdata/parser_tests/upper_field_names.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'parser_tests/upper_field_names.ABOUT')) expected = {'name': 'Apache HTTP Server\nthis is a continuation', 'home_url': 'http://httpd.apache.org', 'download_url': 'http://archive.apache.org/dist/httpd/httpd-2.4.3.tar.gz', @@ -257,11 +261,11 @@ def test_normalize_lowercase(self): self.assertTrue(all(item in about_file.validated_fields.items() for item in expected.items())) def test_validate_about_ref_testing_the_about_resource_field_is_present(self): - about_file = about.AboutFile('testdata/parser_tests/about_resource_field_present.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'parser_tests/about_resource_field_present.ABOUT')) self.assertEquals(about_file.about_resource_path, 'about_resource.c', 'the about_resource was not detected') def test_validate_about_ref_no_about_ref_key(self): - about_file = about.AboutFile('testdata/parser_tests/.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'parser_tests/.ABOUT')) expected_errors = [about.VALUE, 'about_resource'] self.assertTrue(len(about_file.errors) == 1, "This should throw 1 error") for w in about_file.errors: @@ -269,7 +273,7 @@ def test_validate_about_ref_no_about_ref_key(self): self.assertEqual(expected_errors[1], w.field_name) def test_validate_about_resource_error_thrown_when_file_referenced_by_about_file_does_not_exist(self): - about_file = about.AboutFile('testdata/parser_tests/missing_about_ref.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'parser_tests/missing_about_ref.ABOUT')) expected_errors = [about.FILE, 'about_resource'] self.assertTrue(len(about_file.errors) == 1, "This should throw 1 error") for w in about_file.errors: @@ -277,7 +281,7 @@ def test_validate_about_resource_error_thrown_when_file_referenced_by_about_file self.assertEqual(expected_errors[1], w.field_name) def test_validate_mand_fields_name_and_version_and_about_resource_present(self): - about_file = about.AboutFile('testdata/parser_tests/missing_mand.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'parser_tests/missing_mand.ABOUT')) expected_errors = [(about.VALUE, 'about_resource'), (about.VALUE, 'name'), (about.VALUE, 'version'), ] @@ -286,7 +290,7 @@ def test_validate_mand_fields_name_and_version_and_about_resource_present(self): self.assertEqual(expected_errors[i][0], w.code) self.assertEqual(expected_errors[i][1], w.field_name) - about_file = about.AboutFile('testdata/parser_tests/missing_mand_values.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'parser_tests/missing_mand_values.ABOUT')) expected_errors = [(about.VALUE, 'name'), (about.VALUE, 'version'), (about.VALUE, 'about_resource')] @@ -296,7 +300,7 @@ def test_validate_mand_fields_name_and_version_and_about_resource_present(self): self.assertEqual(expected_errors[i][1], w.field_name) def test_validate_optional_file_field_value(self): - about_file = about.AboutFile('testdata/parser_tests/about_file_ref.c.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'parser_tests/about_file_ref.c.ABOUT')) expected_warnings = [about.VALUE, 'notice_file'] self.assertTrue(len(about_file.warnings) == 1, "This should throw one warning") for w in about_file.warnings: @@ -376,27 +380,27 @@ def test_validate_is_ascii_key(self): self.assertFalse(about_file.check_is_ascii(u'測試')) def test_validate_is_ascii_value(self): - about_file = about.AboutFile('testdata/filesfields/non_ascii_field.about') + about_file = about.AboutFile(join(TESTDATA_PATH, 'filesfields/non_ascii_field.about')) expected_errors = [about.ASCII] self.assertTrue(len(about_file.errors) == 1, "This should throw 1 error") self.assertEqual(about_file.errors[0].code, expected_errors[0]) def test_validate_spdx_licenses(self): - about_file = about.AboutFile('testdata/spdx_licenses/incorrect_spdx.about') + about_file = about.AboutFile(join(TESTDATA_PATH, 'spdx_licenses/incorrect_spdx.about')) expected_errors = [about.SPDX] self.assertTrue(len(about_file.errors) == 1, "This should throw 1 error") for w in about_file.errors: self.assertEqual(expected_errors[0], w.code) def test_validate_spdx_licenses1(self): - about_file = about.AboutFile('testdata/spdx_licenses/invalid_multi_format_spdx.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'spdx_licenses/invalid_multi_format_spdx.ABOUT')) expected_errors = [about.SPDX] self.assertTrue(len(about_file.errors) == 1, "This should throw 1 error") for w in about_file.errors: self.assertEqual(expected_errors[0], w.code) def test_validate_spdx_licenses2(self): - about_file = about.AboutFile('testdata/spdx_licenses/invalid_multi_name.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'spdx_licenses/invalid_multi_name.ABOUT')) expected_errors = [about.SPDX] # The test case is: license_spdx: Something and SomeOtherThings # Thus, it should throw 2 errors: 'Something', 'SomeOtherThings' @@ -405,21 +409,21 @@ def test_validate_spdx_licenses2(self): self.assertEqual(expected_errors[0], w.code) def test_validate_spdx_licenses3(self): - about_file = about.AboutFile('testdata/spdx_licenses/lower_case_spdx.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'spdx_licenses/lower_case_spdx.ABOUT')) expected_warnings = [about.SPDX] self.assertTrue(len(about_file.warnings) == 1, "This should throw one warning") for w in about_file.warnings: self.assertEqual(expected_warnings[0], w.code) def test_validate_not_supported_date_format(self): - about_file = about.AboutFile('testdata/DateTest/non-supported_date_format.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'DateTest/non-supported_date_format.ABOUT')) expected_warnings = [about.DATE] self.assertTrue(len(about_file.warnings) == 1, "This should throw one warning") for w in about_file.warnings: self.assertEqual(expected_warnings[0], w.code) def test_validate_supported_date_format(self): - about_file = about.AboutFile('testdata/DateTest/supported_date_format.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'DateTest/supported_date_format.ABOUT')) self.assertTrue(len(about_file.warnings) == 0, "This should not throw warning.") def test_remove_blank_lines_and_field_spaces(self): @@ -468,8 +472,8 @@ def test_remove_blank_lines_and_no_colon_fields(self): def test_generate_attribution(self): expected = u'version:2.4.3about_resource:httpd-2.4.3.tar.gzname:Apache HTTP Server' - about_collector = about.AboutCollector('testdata/attrib/attrib.ABOUT', None, 0) - result = about_collector.generate_attribution('testdata/attrib/test.template') + about_collector = about.AboutCollector(join(TESTDATA_PATH, 'attrib/attrib.ABOUT'), None, 0) + result = about_collector.generate_attribution(join(TESTDATA_PATH, 'attrib/test.template')) self.assertEqual(result, expected) def test_license_text_extracted_from_license_text_file(self): @@ -478,39 +482,36 @@ def test_license_text_extracted_from_license_text_file(self): * Email Test@tester.com for any questions''' - about_file = about.AboutFile('testdata/attrib/license_text.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'attrib/license_text.ABOUT')) license_text = about_file.license_text() self.assertEqual(license_text, expected) def test_notice_text_extacted_from_notice_text_file(self): expected ='''Test component is released to Public Domain.''' - about_file = about.AboutFile('testdata/attrib/license_text.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'attrib/license_text.ABOUT')) notice_text = about_file.notice_text() self.assertEqual(notice_text, expected) def test_license_text_returns_empty_string_when_no_field_present(self): expected = '' - about_file = about.AboutFile('testdata/attrib/no_text_file_field.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'attrib/no_text_file_field.ABOUT')) license_text = about_file.license_text() self.assertEqual(license_text, expected) def test_notice_text_returns_empty_string_when_no_field_present(self): expected = '' - about_file = about.AboutFile('testdata/attrib/no_text_file_field.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'attrib/no_text_file_field.ABOUT')) notice_text = about_file.notice_text() self.assertEqual(notice_text, expected) def test_license_text_returns_empty_string_when_ref_file_doesnt_exist(self): expected = '' - about_file = about.AboutFile('testdata/attrib/missing_notice_license_files.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'attrib/missing_notice_license_files.ABOUT')) license_text = about_file.license_text() self.assertEqual(license_text, expected) def test_notice_text_returns_empty_string_when_ref_file_doesnt_exist(self): expected = '' - about_file = about.AboutFile('testdata/attrib/missing_notice_license_files.ABOUT') + about_file = about.AboutFile(join(TESTDATA_PATH, 'attrib/missing_notice_license_files.ABOUT')) notice_text = about_file.notice_text() self.assertEqual(notice_text, expected) - -if __name__ == "__main__": - unittest.main() diff --git a/gen_tests.py b/about_code_tool/tests/test_genabout.py similarity index 79% rename from gen_tests.py rename to about_code_tool/tests/test_genabout.py index 3f50042d..8b6442fb 100644 --- a/gen_tests.py +++ b/about_code_tool/tests/test_genabout.py @@ -14,27 +14,30 @@ # limitations under the License. # ============================================================================= +from __future__ import print_function from __future__ import with_statement import os -import shutil -import string -from StringIO import StringIO -import tempfile import unittest +from os.path import abspath, dirname, join + +from about_code_tool import genabout + + +TESTDATA_PATH = join(abspath(dirname(__file__)), 'testdata') +GEN_LOCATION = join(TESTDATA_PATH, 'test_files_for_genabout') -import genabout class GenAboutTest(unittest.TestCase): def test_read_input(self): gen = genabout.GenAbout() - test_input = "testdata/test_files_for_genabout/about.csv" + test_input = join(TESTDATA_PATH, "test_files_for_genabout/about.csv") list = gen.read_input(test_input, False) self.assertTrue(list, "List shouldn't be empty.") def test_read_input_missing_about_file(self): gen = genabout.GenAbout() - test_input = "testdata/test_files_for_genabout/missing_about_file.csv" + test_input = join(TESTDATA_PATH, "test_files_for_genabout/missing_about_file.csv") list = gen.read_input(test_input, False) self.assertTrue(len(gen.errors) == 1, "This should return only 1 error.") self.assertFalse(gen.warnings, "No warnings should be returned.") @@ -42,7 +45,7 @@ def test_read_input_missing_about_file(self): def test_read_input_missing_about_resource(self): gen = genabout.GenAbout() - test_input = "testdata/test_files_for_genabout/missing_about_resource.csv" + test_input = join(TESTDATA_PATH, "test_files_for_genabout/missing_about_resource.csv") list = gen.read_input(test_input, False) self.assertTrue(len(gen.errors) == 1, "This should return only 1 error.") self.assertFalse(gen.warnings, "No warnings should be returned.") @@ -50,7 +53,7 @@ def test_read_input_missing_about_resource(self): def test_read_input_missing_about_file_and_resource(self): gen = genabout.GenAbout() - test_input = "testdata/test_files_for_genabout/missing_about_file_and_resource.csv" + test_input = join(TESTDATA_PATH, "test_files_for_genabout/missing_about_file_and_resource.csv") list = gen.read_input(test_input, False) self.assertTrue(len(gen.errors) == 1, "This should return only 1 error.") self.assertFalse(gen.warnings, "No warnings should be returned.") @@ -58,7 +61,7 @@ def test_read_input_missing_about_file_and_resource(self): def test_read_input_valid_and_invalid_rows(self): gen = genabout.GenAbout() - test_input = "testdata/test_files_for_genabout/valid_and_invalid_rows.csv" + test_input = join(TESTDATA_PATH, "test_files_for_genabout/valid_and_invalid_rows.csv") list = gen.read_input(test_input, False) self.assertTrue(len(gen.errors) == 2, "This should return 2 errors.") self.assertFalse(gen.warnings, "No warnings should be returned.") @@ -66,13 +69,13 @@ def test_read_input_valid_and_invalid_rows(self): def test_read_input_with_keys_mapping(self): gen = genabout.GenAbout() - test_input = "testdata/test_files_for_genabout/about-mapping-sample.csv" + test_input = join(TESTDATA_PATH, "test_files_for_genabout/about-mapping-sample.csv") list = gen.read_input(test_input, True) self.assertTrue(list, "List shouldn't be empty.") def test_pre_generation_about_exists_action_0(self): gen = genabout.GenAbout() - gen_location = "testdata/test_files_for_genabout/" + gen_location = join(TESTDATA_PATH, "test_files_for_genabout/") action_num = '0' input_list = [[{'about_file': 'about.py.ABOUT', 'version': '0.8.1', 'about_resource': '.', 'name': 'ABOUT tool'}]] @@ -84,57 +87,53 @@ def test_pre_generation_about_exists_action_0(self): def test_pre_generation_about_exists_action_1(self): gen = genabout.GenAbout() - gen_location = "testdata/test_files_for_genabout/" action_num = '1' input_list = [[{'about_file': 'about.py.ABOUT', 'version': '0.8.2', 'about_resource': '.', 'name': ''}]] - expected_output_list = [['testdata/test_files_for_genabout/about.py.ABOUT', + expected_output_list = [[join(TESTDATA_PATH, 'test_files_for_genabout/about.py.ABOUT'), {'about_file': 'about.py.ABOUT', 'version': '0.8.2', 'about_resource': '.', 'name': 'ABOUT tool'}]] - output_list = gen.pre_generation(gen_location, input_list, action_num, False) + output_list = gen.pre_generation(GEN_LOCATION, input_list, action_num, False) self.assertTrue(expected_output_list == output_list) self.assertFalse(gen.warnings, "No warnings should be returned.") self.assertFalse(gen.errors, "No errors should be returned.") def test_pre_generation_about_exists_action_2(self): gen = genabout.GenAbout() - gen_location = "testdata/test_files_for_genabout/" action_num = '2' input_list = [[{'about_file': 'about.py.ABOUT', 'version': '0.8.2', 'about_resource': '.', 'name': '', 'test': 'test sample'}]] - expected_output_list = [['testdata/test_files_for_genabout/about.py.ABOUT', + expected_output_list = [[join(TESTDATA_PATH, 'test_files_for_genabout/about.py.ABOUT'), {'test': 'test sample', 'about_file': 'about.py.ABOUT', 'version': '0.8.1', 'about_resource': '.', 'name': 'ABOUT tool'}]] - output_list = gen.pre_generation(gen_location, input_list, action_num, False) + output_list = gen.pre_generation(GEN_LOCATION, input_list, action_num, False) self.assertTrue(expected_output_list == output_list) self.assertFalse(gen.warnings, "No warnings should be returned.") self.assertFalse(gen.errors, "No errors should be returned.") def test_pre_generation_about_exists_action_3(self): gen = genabout.GenAbout() - gen_location = "testdata/test_files_for_genabout/" action_num = '3' input_list = [[{'about_file': 'about.py.ABOUT', 'version': '0.8.2', 'about_resource': '.', 'name': '', 'test': 'test sample'}]] - expected_output_list = [['testdata/test_files_for_genabout/about.py.ABOUT', + expected_output_list = [[join(TESTDATA_PATH, 'test_files_for_genabout/about.py.ABOUT'), {'about_file': 'about.py.ABOUT', 'version': '0.8.2', 'about_resource': '.', 'name': '', 'test': 'test sample'}]] - output_list = gen.pre_generation(gen_location, input_list, action_num, False) + output_list = gen.pre_generation(GEN_LOCATION, input_list, action_num, False) self.assertTrue(expected_output_list == output_list) self.assertFalse(gen.warnings, "No warnings should be returned.") self.assertFalse(gen.errors, "No errors should be returned.") def test_pre_generation_all_in_one(self): gen = genabout.GenAbout() - gen_location = "testdata/test_files_for_genabout/" action_num = '0' input_list = [[{'about_file': 'test_generation/elasticsearch.ABOUT', 'version': '0.19.8', 'about_resource': 'elasticsearch-0.19.8.zip', 'name': 'ElasticSearch'}]] expected_output_list = [] - output_list = gen.pre_generation(gen_location, input_list, action_num, True) + output_list = gen.pre_generation(GEN_LOCATION, input_list, action_num, True) self.assertFalse(os.path.exists('testdata/test_files_for_genabout/test_generation'), "This directory shouldn't be generaetd as the all_in_one is set to True.") self.assertTrue(expected_output_list == output_list, "This output_list should be empty.") @@ -143,13 +142,15 @@ def test_pre_generation_all_in_one(self): def test_format_output(self): gen = genabout.GenAbout() - input_list = [['testdata/test_files_for_genabout/about.py.ABOUT', - {'about_file': 'about.py.ABOUT', 'version': '0.8.1', - 'about_resource': '.', 'name': 'ABOUT Tool'}]] - expected_output = [['testdata/test_files_for_genabout/about.py.ABOUT', - 'about_resource: .\nname: ABOUT Tool\nversion: 0.8.1\n\nabout_file: about.py.ABOUT\n']] + input_list = [ + [join(TESTDATA_PATH, 'test_files_for_genabout/about.py.ABOUT'), + {'about_file': 'about.py.ABOUT', 'version': '0.8.1', + 'about_resource': '.', 'name': 'ABOUT Tool'}]] + expected_output = [ + [join(TESTDATA_PATH, 'test_files_for_genabout/about.py.ABOUT'), + 'about_resource: .\nname: ABOUT Tool\nversion: 0.8.1\n\n']] output = gen.format_output(input_list) - self.assertTrue(expected_output == output) + self.assertEqual(expected_output, output) self.assertFalse(gen.warnings, "No warnings should be returned.") self.assertFalse(gen.errors, "No errors should be returned.") @@ -161,7 +162,7 @@ def test_verify_license_files_exist(self): path = '.' expected_list = [['apache2.LICENSE.txt']] output = gen.verify_license_files(input_list, path) - self.assertTrue(expected_list == output) + self.assertEqual(expected_list, output) self.assertFalse(gen.warnings, "No warnings should be returned.") self.assertFalse(gen.errors, "No errors should be returned.") @@ -176,7 +177,3 @@ def test_verify_license_files_not_exist(self): self.assertTrue(expected_list == output) self.assertTrue(len(gen.warnings) == 1, "Should return 1 warning.") self.assertFalse(gen.errors, "No errors should be returned.") - - -if __name__ == "__main__": - unittest.main() diff --git a/testdata/DateTest/non-supported_date_format.ABOUT b/about_code_tool/tests/testdata/DateTest/non-supported_date_format.ABOUT similarity index 100% rename from testdata/DateTest/non-supported_date_format.ABOUT rename to about_code_tool/tests/testdata/DateTest/non-supported_date_format.ABOUT diff --git a/testdata/DateTest/supported_date_format.ABOUT b/about_code_tool/tests/testdata/DateTest/supported_date_format.ABOUT similarity index 100% rename from testdata/DateTest/supported_date_format.ABOUT rename to about_code_tool/tests/testdata/DateTest/supported_date_format.ABOUT diff --git a/testdata/FieldContainsSpaces/about.py b/about_code_tool/tests/testdata/FieldContainsSpaces/about.py similarity index 100% rename from testdata/FieldContainsSpaces/about.py rename to about_code_tool/tests/testdata/FieldContainsSpaces/about.py diff --git a/testdata/FieldContainsSpaces/about.py.ABOUT b/about_code_tool/tests/testdata/FieldContainsSpaces/about.py.ABOUT similarity index 100% rename from testdata/FieldContainsSpaces/about.py.ABOUT rename to about_code_tool/tests/testdata/FieldContainsSpaces/about.py.ABOUT diff --git a/testdata/SCMTests/elasticsearch-0.19.8.zip b/about_code_tool/tests/testdata/SCMTests/elasticsearch-0.19.8.zip similarity index 100% rename from testdata/SCMTests/elasticsearch-0.19.8.zip rename to about_code_tool/tests/testdata/SCMTests/elasticsearch-0.19.8.zip diff --git a/testdata/SCMTests/invalid_git_repo_elasticsearch.ABOUT b/about_code_tool/tests/testdata/SCMTests/invalid_git_repo_elasticsearch.ABOUT similarity index 100% rename from testdata/SCMTests/invalid_git_repo_elasticsearch.ABOUT rename to about_code_tool/tests/testdata/SCMTests/invalid_git_repo_elasticsearch.ABOUT diff --git a/testdata/SCMTests/valid_git_repo_elasticsearch.ABOUT b/about_code_tool/tests/testdata/SCMTests/valid_git_repo_elasticsearch.ABOUT similarity index 100% rename from testdata/SCMTests/valid_git_repo_elasticsearch.ABOUT rename to about_code_tool/tests/testdata/SCMTests/valid_git_repo_elasticsearch.ABOUT diff --git a/testdata/allAboutInOneDir/about_ref/csv_serialize.py.ABOUT b/about_code_tool/tests/testdata/allAboutInOneDir/about_ref/csv_serialize.py.ABOUT similarity index 100% rename from testdata/allAboutInOneDir/about_ref/csv_serialize.py.ABOUT rename to about_code_tool/tests/testdata/allAboutInOneDir/about_ref/csv_serialize.py.ABOUT diff --git a/testdata/allAboutInOneDir/about_ref/django_snippets_2413.ABOUT b/about_code_tool/tests/testdata/allAboutInOneDir/about_ref/django_snippets_2413.ABOUT similarity index 100% rename from testdata/allAboutInOneDir/about_ref/django_snippets_2413.ABOUT rename to about_code_tool/tests/testdata/allAboutInOneDir/about_ref/django_snippets_2413.ABOUT diff --git a/testdata/allAboutInOneDir/about_ref/elasticsearch.ABOUT b/about_code_tool/tests/testdata/allAboutInOneDir/about_ref/elasticsearch.ABOUT similarity index 100% rename from testdata/allAboutInOneDir/about_ref/elasticsearch.ABOUT rename to about_code_tool/tests/testdata/allAboutInOneDir/about_ref/elasticsearch.ABOUT diff --git a/testdata/allAboutInOneDir/about_ref/ez_setup.py.ABOUT b/about_code_tool/tests/testdata/allAboutInOneDir/about_ref/ez_setup.py.ABOUT similarity index 100% rename from testdata/allAboutInOneDir/about_ref/ez_setup.py.ABOUT rename to about_code_tool/tests/testdata/allAboutInOneDir/about_ref/ez_setup.py.ABOUT diff --git a/testdata/allAboutInOneDir/about_ref/t1/t2/ez_setup.py b/about_code_tool/tests/testdata/allAboutInOneDir/about_ref/t1/t2/ez_setup.py similarity index 100% rename from testdata/allAboutInOneDir/about_ref/t1/t2/ez_setup.py rename to about_code_tool/tests/testdata/allAboutInOneDir/about_ref/t1/t2/ez_setup.py diff --git a/testdata/attrib/attrib.ABOUT b/about_code_tool/tests/testdata/attrib/attrib.ABOUT similarity index 100% rename from testdata/attrib/attrib.ABOUT rename to about_code_tool/tests/testdata/attrib/attrib.ABOUT diff --git a/testdata/attrib/license_text.ABOUT b/about_code_tool/tests/testdata/attrib/license_text.ABOUT similarity index 100% rename from testdata/attrib/license_text.ABOUT rename to about_code_tool/tests/testdata/attrib/license_text.ABOUT diff --git a/testdata/attrib/license_text.LICENSE b/about_code_tool/tests/testdata/attrib/license_text.LICENSE similarity index 100% rename from testdata/attrib/license_text.LICENSE rename to about_code_tool/tests/testdata/attrib/license_text.LICENSE diff --git a/testdata/attrib/missing_notice_license_files.ABOUT b/about_code_tool/tests/testdata/attrib/missing_notice_license_files.ABOUT similarity index 100% rename from testdata/attrib/missing_notice_license_files.ABOUT rename to about_code_tool/tests/testdata/attrib/missing_notice_license_files.ABOUT diff --git a/testdata/attrib/no_text_file_field.ABOUT b/about_code_tool/tests/testdata/attrib/no_text_file_field.ABOUT similarity index 100% rename from testdata/attrib/no_text_file_field.ABOUT rename to about_code_tool/tests/testdata/attrib/no_text_file_field.ABOUT diff --git a/testdata/attrib/notice_text.NOTICE b/about_code_tool/tests/testdata/attrib/notice_text.NOTICE similarity index 100% rename from testdata/attrib/notice_text.NOTICE rename to about_code_tool/tests/testdata/attrib/notice_text.NOTICE diff --git a/testdata/attrib/test.template b/about_code_tool/tests/testdata/attrib/test.template similarity index 100% rename from testdata/attrib/test.template rename to about_code_tool/tests/testdata/attrib/test.template diff --git a/testdata/basic/basic.about b/about_code_tool/tests/testdata/basic/basic.about similarity index 100% rename from testdata/basic/basic.about rename to about_code_tool/tests/testdata/basic/basic.about diff --git a/testdata/default_entries/invalid-defaults.ABOUT b/about_code_tool/tests/testdata/default_entries/invalid-defaults.ABOUT similarity index 100% rename from testdata/default_entries/invalid-defaults.ABOUT rename to about_code_tool/tests/testdata/default_entries/invalid-defaults.ABOUT diff --git a/testdata/file_expansion/distribute.ABOUT b/about_code_tool/tests/testdata/file_expansion/distribute.ABOUT similarity index 100% rename from testdata/file_expansion/distribute.ABOUT rename to about_code_tool/tests/testdata/file_expansion/distribute.ABOUT diff --git a/testdata/filesfields/django_snippets.LICENSE b/about_code_tool/tests/testdata/filesfields/django_snippets.LICENSE similarity index 100% rename from testdata/filesfields/django_snippets.LICENSE rename to about_code_tool/tests/testdata/filesfields/django_snippets.LICENSE diff --git a/testdata/filesfields/django_snippets_2413.ABOUT b/about_code_tool/tests/testdata/filesfields/django_snippets_2413.ABOUT similarity index 100% rename from testdata/filesfields/django_snippets_2413.ABOUT rename to about_code_tool/tests/testdata/filesfields/django_snippets_2413.ABOUT diff --git a/testdata/filesfields/django_snippets_2413.py b/about_code_tool/tests/testdata/filesfields/django_snippets_2413.py similarity index 100% rename from testdata/filesfields/django_snippets_2413.py rename to about_code_tool/tests/testdata/filesfields/django_snippets_2413.py diff --git a/testdata/filesfields/non_ascii_field.about b/about_code_tool/tests/testdata/filesfields/non_ascii_field.about similarity index 100% rename from testdata/filesfields/non_ascii_field.about rename to about_code_tool/tests/testdata/filesfields/non_ascii_field.about diff --git a/testdata/filesfields/sym-link-django_snippets_2413.ABOUT b/about_code_tool/tests/testdata/filesfields/sym-link-django_snippets_2413.ABOUT similarity index 100% rename from testdata/filesfields/sym-link-django_snippets_2413.ABOUT rename to about_code_tool/tests/testdata/filesfields/sym-link-django_snippets_2413.ABOUT diff --git a/testdata/filesfields/test.about b/about_code_tool/tests/testdata/filesfields/test.about similarity index 100% rename from testdata/filesfields/test.about rename to about_code_tool/tests/testdata/filesfields/test.about diff --git a/testdata/filesfields/test_folder/django_snippets_2413.ABOUT b/about_code_tool/tests/testdata/filesfields/test_folder/django_snippets_2413.ABOUT similarity index 100% rename from testdata/filesfields/test_folder/django_snippets_2413.ABOUT rename to about_code_tool/tests/testdata/filesfields/test_folder/django_snippets_2413.ABOUT diff --git a/testdata/filesfields/test_folder/test.About b/about_code_tool/tests/testdata/filesfields/test_folder/test.About similarity index 100% rename from testdata/filesfields/test_folder/test.About rename to about_code_tool/tests/testdata/filesfields/test_folder/test.About diff --git a/testdata/filesfields/test_folder/test.py b/about_code_tool/tests/testdata/filesfields/test_folder/test.py similarity index 100% rename from testdata/filesfields/test_folder/test.py rename to about_code_tool/tests/testdata/filesfields/test_folder/test.py diff --git a/testdata/filesfields/test_folder/test1.About b/about_code_tool/tests/testdata/filesfields/test_folder/test1.About similarity index 100% rename from testdata/filesfields/test_folder/test1.About rename to about_code_tool/tests/testdata/filesfields/test_folder/test1.About diff --git a/testdata/filesfields/windows-shortcut-django_snippets_2413.ABOUT b/about_code_tool/tests/testdata/filesfields/windows-shortcut-django_snippets_2413.ABOUT similarity index 100% rename from testdata/filesfields/windows-shortcut-django_snippets_2413.ABOUT rename to about_code_tool/tests/testdata/filesfields/windows-shortcut-django_snippets_2413.ABOUT diff --git a/testdata/haveAboutFile/basic.about b/about_code_tool/tests/testdata/haveAboutFile/basic.about similarity index 100% rename from testdata/haveAboutFile/basic.about rename to about_code_tool/tests/testdata/haveAboutFile/basic.about diff --git a/testdata/haveAboutFile/duplicate_key_names.AbOuT b/about_code_tool/tests/testdata/haveAboutFile/duplicate_key_names.AbOuT similarity index 100% rename from testdata/haveAboutFile/duplicate_key_names.AbOuT rename to about_code_tool/tests/testdata/haveAboutFile/duplicate_key_names.AbOuT diff --git a/testdata/haveAboutFile/duplicate_key_names_2.aBout b/about_code_tool/tests/testdata/haveAboutFile/duplicate_key_names_2.aBout similarity index 100% rename from testdata/haveAboutFile/duplicate_key_names_2.aBout rename to about_code_tool/tests/testdata/haveAboutFile/duplicate_key_names_2.aBout diff --git a/testdata/haveAboutFile/httpd-2.4.3.tar.gz.ABOUT b/about_code_tool/tests/testdata/haveAboutFile/httpd-2.4.3.tar.gz.ABOUT similarity index 100% rename from testdata/haveAboutFile/httpd-2.4.3.tar.gz.ABOUT rename to about_code_tool/tests/testdata/haveAboutFile/httpd-2.4.3.tar.gz.ABOUT diff --git a/testdata/haveAboutFile/invalid_url.About b/about_code_tool/tests/testdata/haveAboutFile/invalid_url.About similarity index 100% rename from testdata/haveAboutFile/invalid_url.About rename to about_code_tool/tests/testdata/haveAboutFile/invalid_url.About diff --git a/testdata/haveAboutFile/optional.About b/about_code_tool/tests/testdata/haveAboutFile/optional.About similarity index 100% rename from testdata/haveAboutFile/optional.About rename to about_code_tool/tests/testdata/haveAboutFile/optional.About diff --git a/testdata/haveAboutFile/test1.about b/about_code_tool/tests/testdata/haveAboutFile/test1.about similarity index 100% rename from testdata/haveAboutFile/test1.about rename to about_code_tool/tests/testdata/haveAboutFile/test1.about diff --git a/testdata/haveAboutFile/test_file b/about_code_tool/tests/testdata/haveAboutFile/test_file similarity index 100% rename from testdata/haveAboutFile/test_file rename to about_code_tool/tests/testdata/haveAboutFile/test_file diff --git a/testdata/mandatory_fields/empty.about b/about_code_tool/tests/testdata/mandatory_fields/empty.about similarity index 100% rename from testdata/mandatory_fields/empty.about rename to about_code_tool/tests/testdata/mandatory_fields/empty.about diff --git a/testdata/mandatory_fields/missing-name-and-version.about b/about_code_tool/tests/testdata/mandatory_fields/missing-name-and-version.about similarity index 100% rename from testdata/mandatory_fields/missing-name-and-version.about rename to about_code_tool/tests/testdata/mandatory_fields/missing-name-and-version.about diff --git a/testdata/mandatory_fields/missing-name.about b/about_code_tool/tests/testdata/mandatory_fields/missing-name.about similarity index 100% rename from testdata/mandatory_fields/missing-name.about rename to about_code_tool/tests/testdata/mandatory_fields/missing-name.about diff --git a/testdata/mandatory_fields/missing-version.about b/about_code_tool/tests/testdata/mandatory_fields/missing-version.about similarity index 100% rename from testdata/mandatory_fields/missing-version.about rename to about_code_tool/tests/testdata/mandatory_fields/missing-version.about diff --git a/testdata/noAboutFile/test_file b/about_code_tool/tests/testdata/noAboutFile/test_file similarity index 100% rename from testdata/noAboutFile/test_file rename to about_code_tool/tests/testdata/noAboutFile/test_file diff --git a/testdata/no_colon/about.py b/about_code_tool/tests/testdata/no_colon/about.py similarity index 100% rename from testdata/no_colon/about.py rename to about_code_tool/tests/testdata/no_colon/about.py diff --git a/testdata/no_colon/about.py.ABOUT b/about_code_tool/tests/testdata/no_colon/about.py.ABOUT similarity index 100% rename from testdata/no_colon/about.py.ABOUT rename to about_code_tool/tests/testdata/no_colon/about.py.ABOUT diff --git a/testdata/output/test.csv b/about_code_tool/tests/testdata/output/test.csv similarity index 100% rename from testdata/output/test.csv rename to about_code_tool/tests/testdata/output/test.csv diff --git a/testdata/output/testoutput-old.csv b/about_code_tool/tests/testdata/output/testoutput-old.csv similarity index 100% rename from testdata/output/testoutput-old.csv rename to about_code_tool/tests/testdata/output/testoutput-old.csv diff --git a/testdata/output/testoutput.csv b/about_code_tool/tests/testdata/output/testoutput.csv similarity index 100% rename from testdata/output/testoutput.csv rename to about_code_tool/tests/testdata/output/testoutput.csv diff --git a/testdata/output/testparser.csv b/about_code_tool/tests/testdata/output/testparser.csv similarity index 100% rename from testdata/output/testparser.csv rename to about_code_tool/tests/testdata/output/testparser.csv diff --git a/testdata/output/thirdparty-testdata.csv b/about_code_tool/tests/testdata/output/thirdparty-testdata.csv similarity index 100% rename from testdata/output/thirdparty-testdata.csv rename to about_code_tool/tests/testdata/output/thirdparty-testdata.csv diff --git a/testdata/parser_tests/.ABOUT b/about_code_tool/tests/testdata/parser_tests/.ABOUT similarity index 100% rename from testdata/parser_tests/.ABOUT rename to about_code_tool/tests/testdata/parser_tests/.ABOUT diff --git a/testdata/parser_tests/COPYING b/about_code_tool/tests/testdata/parser_tests/COPYING similarity index 100% rename from testdata/parser_tests/COPYING rename to about_code_tool/tests/testdata/parser_tests/COPYING diff --git a/testdata/parser_tests/about_file_ref.c.ABOUT b/about_code_tool/tests/testdata/parser_tests/about_file_ref.c.ABOUT similarity index 100% rename from testdata/parser_tests/about_file_ref.c.ABOUT rename to about_code_tool/tests/testdata/parser_tests/about_file_ref.c.ABOUT diff --git a/testdata/parser_tests/about_resource.c b/about_code_tool/tests/testdata/parser_tests/about_resource.c similarity index 100% rename from testdata/parser_tests/about_resource.c rename to about_code_tool/tests/testdata/parser_tests/about_resource.c diff --git a/testdata/parser_tests/about_resource_field_present.ABOUT b/about_code_tool/tests/testdata/parser_tests/about_resource_field_present.ABOUT similarity index 100% rename from testdata/parser_tests/about_resource_field_present.ABOUT rename to about_code_tool/tests/testdata/parser_tests/about_resource_field_present.ABOUT diff --git a/testdata/parser_tests/dupe_field_name.ABOUT b/about_code_tool/tests/testdata/parser_tests/dupe_field_name.ABOUT similarity index 100% rename from testdata/parser_tests/dupe_field_name.ABOUT rename to about_code_tool/tests/testdata/parser_tests/dupe_field_name.ABOUT diff --git a/testdata/parser_tests/missing_about_ref.ABOUT b/about_code_tool/tests/testdata/parser_tests/missing_about_ref.ABOUT similarity index 100% rename from testdata/parser_tests/missing_about_ref.ABOUT rename to about_code_tool/tests/testdata/parser_tests/missing_about_ref.ABOUT diff --git a/testdata/parser_tests/missing_mand.ABOUT b/about_code_tool/tests/testdata/parser_tests/missing_mand.ABOUT similarity index 100% rename from testdata/parser_tests/missing_mand.ABOUT rename to about_code_tool/tests/testdata/parser_tests/missing_mand.ABOUT diff --git a/testdata/parser_tests/missing_mand_values.ABOUT b/about_code_tool/tests/testdata/parser_tests/missing_mand_values.ABOUT similarity index 100% rename from testdata/parser_tests/missing_mand_values.ABOUT rename to about_code_tool/tests/testdata/parser_tests/missing_mand_values.ABOUT diff --git a/testdata/parser_tests/test.ABOUT b/about_code_tool/tests/testdata/parser_tests/test.ABOUT similarity index 100% rename from testdata/parser_tests/test.ABOUT rename to about_code_tool/tests/testdata/parser_tests/test.ABOUT diff --git a/testdata/parser_tests/upper_field_names.ABOUT b/about_code_tool/tests/testdata/parser_tests/upper_field_names.ABOUT similarity index 100% rename from testdata/parser_tests/upper_field_names.ABOUT rename to about_code_tool/tests/testdata/parser_tests/upper_field_names.ABOUT diff --git a/testdata/spdx_licenses/incorrect_spdx.about b/about_code_tool/tests/testdata/spdx_licenses/incorrect_spdx.about similarity index 100% rename from testdata/spdx_licenses/incorrect_spdx.about rename to about_code_tool/tests/testdata/spdx_licenses/incorrect_spdx.about diff --git a/testdata/spdx_licenses/invalid_multi_format_spdx.ABOUT b/about_code_tool/tests/testdata/spdx_licenses/invalid_multi_format_spdx.ABOUT similarity index 100% rename from testdata/spdx_licenses/invalid_multi_format_spdx.ABOUT rename to about_code_tool/tests/testdata/spdx_licenses/invalid_multi_format_spdx.ABOUT diff --git a/testdata/spdx_licenses/invalid_multi_name.ABOUT b/about_code_tool/tests/testdata/spdx_licenses/invalid_multi_name.ABOUT similarity index 100% rename from testdata/spdx_licenses/invalid_multi_name.ABOUT rename to about_code_tool/tests/testdata/spdx_licenses/invalid_multi_name.ABOUT diff --git a/testdata/spdx_licenses/lower_case_spdx.ABOUT b/about_code_tool/tests/testdata/spdx_licenses/lower_case_spdx.ABOUT similarity index 100% rename from testdata/spdx_licenses/lower_case_spdx.ABOUT rename to about_code_tool/tests/testdata/spdx_licenses/lower_case_spdx.ABOUT diff --git a/testdata/spdx_licenses/multi_and.ABOUT b/about_code_tool/tests/testdata/spdx_licenses/multi_and.ABOUT similarity index 100% rename from testdata/spdx_licenses/multi_and.ABOUT rename to about_code_tool/tests/testdata/spdx_licenses/multi_and.ABOUT diff --git a/testdata/spdx_licenses/multi_or.ABOUT b/about_code_tool/tests/testdata/spdx_licenses/multi_or.ABOUT similarity index 100% rename from testdata/spdx_licenses/multi_or.ABOUT rename to about_code_tool/tests/testdata/spdx_licenses/multi_or.ABOUT diff --git a/testdata/spdx_licenses/test.ABOUT b/about_code_tool/tests/testdata/spdx_licenses/test.ABOUT similarity index 100% rename from testdata/spdx_licenses/test.ABOUT rename to about_code_tool/tests/testdata/spdx_licenses/test.ABOUT diff --git a/testdata/test_files_for_genabout/about-mapping-sample.csv b/about_code_tool/tests/testdata/test_files_for_genabout/about-mapping-sample.csv similarity index 100% rename from testdata/test_files_for_genabout/about-mapping-sample.csv rename to about_code_tool/tests/testdata/test_files_for_genabout/about-mapping-sample.csv diff --git a/testdata/test_files_for_genabout/about.csv b/about_code_tool/tests/testdata/test_files_for_genabout/about.csv similarity index 100% rename from testdata/test_files_for_genabout/about.csv rename to about_code_tool/tests/testdata/test_files_for_genabout/about.csv diff --git a/testdata/test_files_for_genabout/about.py.ABOUT b/about_code_tool/tests/testdata/test_files_for_genabout/about.py.ABOUT similarity index 100% rename from testdata/test_files_for_genabout/about.py.ABOUT rename to about_code_tool/tests/testdata/test_files_for_genabout/about.py.ABOUT diff --git a/testdata/test_files_for_genabout/elasticsearch.ABOUT b/about_code_tool/tests/testdata/test_files_for_genabout/elasticsearch.ABOUT similarity index 100% rename from testdata/test_files_for_genabout/elasticsearch.ABOUT rename to about_code_tool/tests/testdata/test_files_for_genabout/elasticsearch.ABOUT diff --git a/testdata/test_files_for_genabout/missing_about_file.csv b/about_code_tool/tests/testdata/test_files_for_genabout/missing_about_file.csv similarity index 100% rename from testdata/test_files_for_genabout/missing_about_file.csv rename to about_code_tool/tests/testdata/test_files_for_genabout/missing_about_file.csv diff --git a/testdata/test_files_for_genabout/missing_about_file_and_resource.csv b/about_code_tool/tests/testdata/test_files_for_genabout/missing_about_file_and_resource.csv similarity index 100% rename from testdata/test_files_for_genabout/missing_about_file_and_resource.csv rename to about_code_tool/tests/testdata/test_files_for_genabout/missing_about_file_and_resource.csv diff --git a/testdata/test_files_for_genabout/missing_about_resource.csv b/about_code_tool/tests/testdata/test_files_for_genabout/missing_about_resource.csv similarity index 100% rename from testdata/test_files_for_genabout/missing_about_resource.csv rename to about_code_tool/tests/testdata/test_files_for_genabout/missing_about_resource.csv diff --git a/testdata/test_files_for_genabout/thirdparty.csv b/about_code_tool/tests/testdata/test_files_for_genabout/thirdparty.csv similarity index 100% rename from testdata/test_files_for_genabout/thirdparty.csv rename to about_code_tool/tests/testdata/test_files_for_genabout/thirdparty.csv diff --git a/testdata/test_files_for_genabout/valid_and_invalid_rows.csv b/about_code_tool/tests/testdata/test_files_for_genabout/valid_and_invalid_rows.csv similarity index 100% rename from testdata/test_files_for_genabout/valid_and_invalid_rows.csv rename to about_code_tool/tests/testdata/test_files_for_genabout/valid_and_invalid_rows.csv diff --git a/testdata/test_for_continuation_lines/test_input.ABOUT b/about_code_tool/tests/testdata/test_for_continuation_lines/test_input.ABOUT similarity index 100% rename from testdata/test_for_continuation_lines/test_input.ABOUT rename to about_code_tool/tests/testdata/test_for_continuation_lines/test_input.ABOUT diff --git a/testdata/test_for_dir/include_all-1.ABOUT b/about_code_tool/tests/testdata/test_for_dir/include_all-1.ABOUT similarity index 100% rename from testdata/test_for_dir/include_all-1.ABOUT rename to about_code_tool/tests/testdata/test_for_dir/include_all-1.ABOUT diff --git a/testdata/test_for_dir/include_all.ABOUT b/about_code_tool/tests/testdata/test_for_dir/include_all.ABOUT similarity index 100% rename from testdata/test_for_dir/include_all.ABOUT rename to about_code_tool/tests/testdata/test_for_dir/include_all.ABOUT diff --git a/testdata/test_for_dir/test_dir.ABOUT b/about_code_tool/tests/testdata/test_for_dir/test_dir.ABOUT similarity index 100% rename from testdata/test_for_dir/test_dir.ABOUT rename to about_code_tool/tests/testdata/test_for_dir/test_dir.ABOUT diff --git a/testdata/thirdparty/FixedHeader-2.0.6.zip b/about_code_tool/tests/testdata/thirdparty/FixedHeader-2.0.6.zip similarity index 100% rename from testdata/thirdparty/FixedHeader-2.0.6.zip rename to about_code_tool/tests/testdata/thirdparty/FixedHeader-2.0.6.zip diff --git a/testdata/thirdparty/FixedHeader.ABOUT b/about_code_tool/tests/testdata/thirdparty/FixedHeader.ABOUT similarity index 100% rename from testdata/thirdparty/FixedHeader.ABOUT rename to about_code_tool/tests/testdata/thirdparty/FixedHeader.ABOUT diff --git a/testdata/thirdparty/FixedHeader.LICENSE b/about_code_tool/tests/testdata/thirdparty/FixedHeader.LICENSE similarity index 100% rename from testdata/thirdparty/FixedHeader.LICENSE rename to about_code_tool/tests/testdata/thirdparty/FixedHeader.LICENSE diff --git a/testdata/thirdparty/Font-Awesome-v3.0.2.zip b/about_code_tool/tests/testdata/thirdparty/Font-Awesome-v3.0.2.zip similarity index 100% rename from testdata/thirdparty/Font-Awesome-v3.0.2.zip rename to about_code_tool/tests/testdata/thirdparty/Font-Awesome-v3.0.2.zip diff --git a/testdata/thirdparty/Font-Awesome.ABOUT b/about_code_tool/tests/testdata/thirdparty/Font-Awesome.ABOUT similarity index 100% rename from testdata/thirdparty/Font-Awesome.ABOUT rename to about_code_tool/tests/testdata/thirdparty/Font-Awesome.ABOUT diff --git a/testdata/thirdparty/Font-Awesome.NOTICE b/about_code_tool/tests/testdata/thirdparty/Font-Awesome.NOTICE similarity index 100% rename from testdata/thirdparty/Font-Awesome.NOTICE rename to about_code_tool/tests/testdata/thirdparty/Font-Awesome.NOTICE diff --git a/testdata/thirdparty/csv_serialize.py b/about_code_tool/tests/testdata/thirdparty/csv_serialize.py similarity index 100% rename from testdata/thirdparty/csv_serialize.py rename to about_code_tool/tests/testdata/thirdparty/csv_serialize.py diff --git a/testdata/thirdparty/csv_serialize.py.ABOUT b/about_code_tool/tests/testdata/thirdparty/csv_serialize.py.ABOUT similarity index 100% rename from testdata/thirdparty/csv_serialize.py.ABOUT rename to about_code_tool/tests/testdata/thirdparty/csv_serialize.py.ABOUT diff --git a/testdata/thirdparty/django_snippets.LICENSE b/about_code_tool/tests/testdata/thirdparty/django_snippets.LICENSE similarity index 100% rename from testdata/thirdparty/django_snippets.LICENSE rename to about_code_tool/tests/testdata/thirdparty/django_snippets.LICENSE diff --git a/testdata/thirdparty/django_snippets_2413.ABOUT b/about_code_tool/tests/testdata/thirdparty/django_snippets_2413.ABOUT similarity index 100% rename from testdata/thirdparty/django_snippets_2413.ABOUT rename to about_code_tool/tests/testdata/thirdparty/django_snippets_2413.ABOUT diff --git a/testdata/thirdparty/django_snippets_2413.py b/about_code_tool/tests/testdata/thirdparty/django_snippets_2413.py similarity index 100% rename from testdata/thirdparty/django_snippets_2413.py rename to about_code_tool/tests/testdata/thirdparty/django_snippets_2413.py diff --git a/testdata/thirdparty/elasticsearch-0.19.8.zip b/about_code_tool/tests/testdata/thirdparty/elasticsearch-0.19.8.zip similarity index 100% rename from testdata/thirdparty/elasticsearch-0.19.8.zip rename to about_code_tool/tests/testdata/thirdparty/elasticsearch-0.19.8.zip diff --git a/testdata/thirdparty/elasticsearch-sources.ABOUT b/about_code_tool/tests/testdata/thirdparty/elasticsearch-sources.ABOUT similarity index 100% rename from testdata/thirdparty/elasticsearch-sources.ABOUT rename to about_code_tool/tests/testdata/thirdparty/elasticsearch-sources.ABOUT diff --git a/testdata/thirdparty/elasticsearch-v0.19.8-g7badcde.tar.gz b/about_code_tool/tests/testdata/thirdparty/elasticsearch-v0.19.8-g7badcde.tar.gz similarity index 100% rename from testdata/thirdparty/elasticsearch-v0.19.8-g7badcde.tar.gz rename to about_code_tool/tests/testdata/thirdparty/elasticsearch-v0.19.8-g7badcde.tar.gz diff --git a/testdata/thirdparty/elasticsearch.ABOUT b/about_code_tool/tests/testdata/thirdparty/elasticsearch.ABOUT similarity index 100% rename from testdata/thirdparty/elasticsearch.ABOUT rename to about_code_tool/tests/testdata/thirdparty/elasticsearch.ABOUT diff --git a/testdata/thirdparty/elasticsearch.LICENSE b/about_code_tool/tests/testdata/thirdparty/elasticsearch.LICENSE similarity index 100% rename from testdata/thirdparty/elasticsearch.LICENSE rename to about_code_tool/tests/testdata/thirdparty/elasticsearch.LICENSE diff --git a/testdata/thirdparty/elasticsearch.NOTICE b/about_code_tool/tests/testdata/thirdparty/elasticsearch.NOTICE similarity index 100% rename from testdata/thirdparty/elasticsearch.NOTICE rename to about_code_tool/tests/testdata/thirdparty/elasticsearch.NOTICE diff --git a/testdata/thirdparty/ez_setup.py b/about_code_tool/tests/testdata/thirdparty/ez_setup.py similarity index 100% rename from testdata/thirdparty/ez_setup.py rename to about_code_tool/tests/testdata/thirdparty/ez_setup.py diff --git a/testdata/thirdparty/ez_setup.py.ABOUT b/about_code_tool/tests/testdata/thirdparty/ez_setup.py.ABOUT similarity index 100% rename from testdata/thirdparty/ez_setup.py.ABOUT rename to about_code_tool/tests/testdata/thirdparty/ez_setup.py.ABOUT diff --git a/testdata/thirdparty/jquery-1.7.2.js b/about_code_tool/tests/testdata/thirdparty/jquery-1.7.2.js similarity index 100% rename from testdata/thirdparty/jquery-1.7.2.js rename to about_code_tool/tests/testdata/thirdparty/jquery-1.7.2.js diff --git a/testdata/thirdparty/jquery-1.7.2.min.js b/about_code_tool/tests/testdata/thirdparty/jquery-1.7.2.min.js similarity index 100% rename from testdata/thirdparty/jquery-1.7.2.min.js rename to about_code_tool/tests/testdata/thirdparty/jquery-1.7.2.min.js diff --git a/testdata/thirdparty/jquery.js.ABOUT b/about_code_tool/tests/testdata/thirdparty/jquery.js.ABOUT similarity index 100% rename from testdata/thirdparty/jquery.js.ABOUT rename to about_code_tool/tests/testdata/thirdparty/jquery.js.ABOUT diff --git a/testdata/thirdparty/jquery.js.LICENSE b/about_code_tool/tests/testdata/thirdparty/jquery.js.LICENSE similarity index 100% rename from testdata/thirdparty/jquery.js.LICENSE rename to about_code_tool/tests/testdata/thirdparty/jquery.js.LICENSE diff --git a/testdata/thirdparty/jquery.jsPlumb-1.3.10-all-min.js b/about_code_tool/tests/testdata/thirdparty/jquery.jsPlumb-1.3.10-all-min.js similarity index 100% rename from testdata/thirdparty/jquery.jsPlumb-1.3.10-all-min.js rename to about_code_tool/tests/testdata/thirdparty/jquery.jsPlumb-1.3.10-all-min.js diff --git a/testdata/thirdparty/jquery.jsPlumb.ABOUT b/about_code_tool/tests/testdata/thirdparty/jquery.jsPlumb.ABOUT similarity index 100% rename from testdata/thirdparty/jquery.jsPlumb.ABOUT rename to about_code_tool/tests/testdata/thirdparty/jquery.jsPlumb.ABOUT diff --git a/testdata/thirdparty/jquery.jsPlumb.LICENSE b/about_code_tool/tests/testdata/thirdparty/jquery.jsPlumb.LICENSE similarity index 100% rename from testdata/thirdparty/jquery.jsPlumb.LICENSE rename to about_code_tool/tests/testdata/thirdparty/jquery.jsPlumb.LICENSE diff --git a/testdata/thirdparty/jquery.min.js.ABOUT b/about_code_tool/tests/testdata/thirdparty/jquery.min.js.ABOUT similarity index 100% rename from testdata/thirdparty/jquery.min.js.ABOUT rename to about_code_tool/tests/testdata/thirdparty/jquery.min.js.ABOUT diff --git a/testdata/thirdparty/mod_wsgi-3.3.tar.gz b/about_code_tool/tests/testdata/thirdparty/mod_wsgi-3.3.tar.gz similarity index 100% rename from testdata/thirdparty/mod_wsgi-3.3.tar.gz rename to about_code_tool/tests/testdata/thirdparty/mod_wsgi-3.3.tar.gz diff --git a/testdata/thirdparty/mod_wsgi-3.3.tar.gz.ABOUT b/about_code_tool/tests/testdata/thirdparty/mod_wsgi-3.3.tar.gz.ABOUT similarity index 100% rename from testdata/thirdparty/mod_wsgi-3.3.tar.gz.ABOUT rename to about_code_tool/tests/testdata/thirdparty/mod_wsgi-3.3.tar.gz.ABOUT diff --git a/testdata/thirdparty/okfn-annotator-549159b.zip b/about_code_tool/tests/testdata/thirdparty/okfn-annotator-549159b.zip similarity index 100% rename from testdata/thirdparty/okfn-annotator-549159b.zip rename to about_code_tool/tests/testdata/thirdparty/okfn-annotator-549159b.zip diff --git a/testdata/thirdparty/okfn-annotator.ABOUT b/about_code_tool/tests/testdata/thirdparty/okfn-annotator.ABOUT similarity index 100% rename from testdata/thirdparty/okfn-annotator.ABOUT rename to about_code_tool/tests/testdata/thirdparty/okfn-annotator.ABOUT diff --git a/testdata/thirdparty/okfn-annotator.LICENSE b/about_code_tool/tests/testdata/thirdparty/okfn-annotator.LICENSE similarity index 100% rename from testdata/thirdparty/okfn-annotator.LICENSE rename to about_code_tool/tests/testdata/thirdparty/okfn-annotator.LICENSE diff --git a/testdata/thirdparty/setuptools.ABOUT b/about_code_tool/tests/testdata/thirdparty/setuptools.ABOUT similarity index 100% rename from testdata/thirdparty/setuptools.ABOUT rename to about_code_tool/tests/testdata/thirdparty/setuptools.ABOUT diff --git a/testdata/thirdparty/twitter_bootstrap.ABOUT b/about_code_tool/tests/testdata/thirdparty/twitter_bootstrap.ABOUT similarity index 100% rename from testdata/thirdparty/twitter_bootstrap.ABOUT rename to about_code_tool/tests/testdata/thirdparty/twitter_bootstrap.ABOUT diff --git a/testdata/thirdparty/twitter_bootstrap.LICENSE b/about_code_tool/tests/testdata/thirdparty/twitter_bootstrap.LICENSE similarity index 100% rename from testdata/thirdparty/twitter_bootstrap.LICENSE rename to about_code_tool/tests/testdata/thirdparty/twitter_bootstrap.LICENSE diff --git a/testdata/thirdparty/twitter_bootstrap_v2.0.3.zip b/about_code_tool/tests/testdata/thirdparty/twitter_bootstrap_v2.0.3.zip similarity index 100% rename from testdata/thirdparty/twitter_bootstrap_v2.0.3.zip rename to about_code_tool/tests/testdata/thirdparty/twitter_bootstrap_v2.0.3.zip diff --git a/testdata/thirdparty/underscore-min.js b/about_code_tool/tests/testdata/thirdparty/underscore-min.js similarity index 100% rename from testdata/thirdparty/underscore-min.js rename to about_code_tool/tests/testdata/thirdparty/underscore-min.js diff --git a/testdata/thirdparty/underscore-min.js.ABOUT b/about_code_tool/tests/testdata/thirdparty/underscore-min.js.ABOUT similarity index 100% rename from testdata/thirdparty/underscore-min.js.ABOUT rename to about_code_tool/tests/testdata/thirdparty/underscore-min.js.ABOUT diff --git a/testdata/thirdparty/underscore.js b/about_code_tool/tests/testdata/thirdparty/underscore.js similarity index 100% rename from testdata/thirdparty/underscore.js rename to about_code_tool/tests/testdata/thirdparty/underscore.js diff --git a/testdata/thirdparty/underscore.js.ABOUT b/about_code_tool/tests/testdata/thirdparty/underscore.js.ABOUT similarity index 100% rename from testdata/thirdparty/underscore.js.ABOUT rename to about_code_tool/tests/testdata/thirdparty/underscore.js.ABOUT diff --git a/testdata/thirdparty/underscore.js.LICENSE b/about_code_tool/tests/testdata/thirdparty/underscore.js.LICENSE similarity index 100% rename from testdata/thirdparty/underscore.js.LICENSE rename to about_code_tool/tests/testdata/thirdparty/underscore.js.LICENSE diff --git a/testdata/unicode/nose-selecttests.ABOUT b/about_code_tool/tests/testdata/unicode/nose-selecttests.ABOUT similarity index 100% rename from testdata/unicode/nose-selecttests.ABOUT rename to about_code_tool/tests/testdata/unicode/nose-selecttests.ABOUT diff --git a/setup.py b/setup.py index 8d36669f..255b5bae 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,14 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- +from __future__ import print_function from setuptools import setup +from about_code_tool import about + + setup( name="about-code-tool", - version="0.8.1", + version=about.__version__, description="Document the origin of third-party software.", author="Jillian Daguil, Chin Yeung Li, Philippe Ombredanne, Thomas Druez", author_email="info@nexb.com", @@ -13,6 +18,29 @@ interesting information about third-party software components that you use in your project.""", license='Apache License 2.0', - py_modules=['about', 'genabout'], - zip_safe=False + packages=[ + 'about_code_tool', + 'about_code_tool.tests' + ], + package_data={ + 'about_code_tool': ['templates/*'], + }, + include_package_data=True, + zip_safe=False, + test_suite='about_code_tool.tests', + platforms='any', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: OS Independent', + 'Natural Language :: English', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Topic :: Software Development', + 'Topic :: Software Development :: Documentation', + 'Topic :: Software Development :: Quality Assurance', + 'Topic :: System :: Software Distribution', + 'Topic :: Utilities', + ], )