Skip to content

Commit 6b92ccf

Browse files
committed
#267 Add test highlighting a diskcache bug
* this is a Python pickle bug * somehow, some data structures cannot be pickled with HIGHEST_PROTOCOL * But they pickle alright with no proptocol set Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 50bfc21 commit 6b92ccf

2 files changed

Lines changed: 141 additions & 0 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"name": "async",
3+
"description": "Higher-order functions and common patterns for asynchronous code",
4+
"main": "lib/async.js",
5+
"author": {
6+
"name": "Caolan McMahon"
7+
},
8+
"version": "1.2.1",
9+
"keywords": [
10+
"async",
11+
"callback",
12+
"utility",
13+
"module"
14+
],
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://github.com/caolan/async.git"
18+
},
19+
"bugs": {
20+
"url": "https://github.com/caolan/async/issues"
21+
},
22+
"license": "MIT",
23+
"devDependencies": {
24+
"benchmark": "github:bestiejs/benchmark.js",
25+
"coveralls": "^2.11.2",
26+
"jshint": "~2.7.0",
27+
"lodash": ">=2.4.1",
28+
"mkdirp": "~0.5.1",
29+
"nodeunit": ">0.0.0",
30+
"nyc": "^2.1.0",
31+
"uglify-js": "1.2.x",
32+
"yargs": "~3.9.1"
33+
},
34+
"jam": {
35+
"main": "lib/async.js",
36+
"include": [
37+
"lib/async.js",
38+
"README.md",
39+
"LICENSE"
40+
],
41+
"categories": [
42+
"Utilities"
43+
]
44+
},
45+
"scripts": {
46+
"test": "npm run-script lint && nodeunit test/test-async.js",
47+
"lint": "jshint lib/*.js test/*.js perf/*.js",
48+
"coverage": "nyc npm test && nyc report",
49+
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
50+
},
51+
"spm": {
52+
"main": "lib/async.js"
53+
},
54+
"volo": {
55+
"main": "lib/async.js",
56+
"ignore": [
57+
"**/.*",
58+
"node_modules",
59+
"bower_components",
60+
"test",
61+
"tests"
62+
]
63+
},
64+
"gitHead": "b66e85d1cca8c8056313253f22d18f571e7001d2",
65+
"homepage": "https://github.com/caolan/async#readme",
66+
"_id": "async@1.2.1",
67+
"_shasum": "a4816a17cd5ff516dfa2c7698a453369b9790de0",
68+
"_from": "async@*",
69+
"_npmVersion": "2.9.0",
70+
"_nodeVersion": "2.0.2",
71+
"_npmUser": {
72+
"name": "aearly",
73+
"email": "alexander.early@gmail.com"
74+
},
75+
"maintainers": [
76+
{
77+
"name": "caolan",
78+
"email": "caolan.mcmahon@gmail.com"
79+
},
80+
{
81+
"name": "beaugunderson",
82+
"email": "beau@beaugunderson.com"
83+
},
84+
{
85+
"name": "aearly",
86+
"email": "alexander.early@gmail.com"
87+
}
88+
],
89+
"dist": {
90+
"shasum": "a4816a17cd5ff516dfa2c7698a453369b9790de0",
91+
"tarball": "http://registry.npmjs.org/async/-/async-1.2.1.tgz"
92+
},
93+
"directories": {},
94+
"_resolved": "https://registry.npmjs.org/async/-/async-1.2.1.tgz",
95+
"readme": "ERROR: No README data found!"
96+
}

tests/scancode/test_cache.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Copyright (c) 2016 nexB Inc. and others. All rights reserved.
3+
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
4+
# The ScanCode software is licensed under the Apache License version 2.0.
5+
# Data generated with ScanCode require an acknowledgment.
6+
# ScanCode is a trademark of nexB Inc.
7+
#
8+
# You may not use this software except in compliance with the License.
9+
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
10+
# Unless required by applicable law or agreed to in writing, software distributed
11+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
13+
# specific language governing permissions and limitations under the License.
14+
#
15+
# When you publish or redistribute any data created with ScanCode or any ScanCode
16+
# derivative work, you must accompany this data with the following acknowledgment:
17+
#
18+
# Generated with ScanCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
19+
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
20+
# ScanCode should be considered or used as legal advice. Consult an Attorney
21+
# for any legal advice.
22+
# ScanCode is a free software code scanning tool from nexB Inc. and others.
23+
# Visit https://github.com/nexB/scancode-toolkit/ for support and download.
24+
25+
from __future__ import absolute_import, print_function
26+
27+
import os
28+
29+
from commoncode.testcase import FileBasedTesting
30+
31+
from scancode.cache import ScanCache
32+
33+
34+
class TestCache(FileBasedTesting):
35+
test_data_dir = os.path.join(os.path.dirname(__file__), 'data')
36+
37+
def test_can_cache(self):
38+
test_file = self.get_test_loc('cache/package/package.json')
39+
from scancode import api
40+
package = api.get_package_infos(test_file)
41+
42+
test_dir = self.get_temp_dir()
43+
cache = ScanCache(test_dir)
44+
cache.put_infos(path='abc', file_infos=dict(sha1='def'))
45+
cache.put_scan(path='abc', file_infos=dict(sha1='def'), scan_result=package)

0 commit comments

Comments
 (0)