Skip to content

Commit

Permalink
New repo structure (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillTim authored and marco-c committed Apr 20, 2017
1 parent 7285b9e commit 86786e1
Show file tree
Hide file tree
Showing 19 changed files with 404 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -8,7 +8,7 @@ install:
- pip install -r requirements.txt
- pip install -r test-requirements.txt
script:
- coverage run -m unittest discover tests
- coverage run -m py.test tests
- flake8
after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
373 changes: 373 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Makefile
@@ -0,0 +1,6 @@
init:
pip install -r requirements.txt
pip install -r test-requirements.txt

test:
py.test tests
16 changes: 3 additions & 13 deletions README.md
Expand Up @@ -3,22 +3,12 @@
[![Build Status](https://travis-ci.org/marco-c/crashsimilarity.svg?branch=master)](https://travis-ci.org/marco-c/crashsimilarity)
[![codecov](https://codecov.io/gh/marco-c/crashsimilarity/branch/master/graph/badge.svg)](https://codecov.io/gh/marco-c/crashsimilarity)

## Running tests
## Tests

With Python 2:
```sh
# Run all tests
python2 -m unittest discover tests
py.test tests

# Run a specific test
python2 -m unittest tests.test_basic
```

With Python 3:
```sh
# Run all tests
python3 -m unittest discover tests

# Run a specific test
python3 -m unittest tests/test_basic
py.test tests/test_utils.py
```
Empty file added crashsimilarity/__init__.py
Empty file.
6 changes: 1 addition & 5 deletions bugzilla.py → crashsimilarity/bugzilla.py
@@ -1,8 +1,4 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import utils
from crashsimilarity import utils


def get_signatures_from_bug(bug_id):
Expand Down
12 changes: 3 additions & 9 deletions crash_similarity.py → crashsimilarity/crash_similarity.py
@@ -1,24 +1,18 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import bisect
import json
import logging
import multiprocessing
import os
import random
import time
import logging

import gensim
import numpy as np

import pyximport
from pyemd import emd

import download_data
import utils
from download_data import download_stack_traces_for_signature
from crashsimilarity import download_data, utils
from crashsimilarity.download_data import download_stack_traces_for_signature

pyximport.install()

Expand Down
12 changes: 5 additions & 7 deletions download_data.py → crashsimilarity/download_data.py
@@ -1,13 +1,11 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import os
import json
import logging
import os
from datetime import timedelta

import dateutil.parser
import utils
import logging

from crashsimilarity import utils

SCHEMA_VERSION = '1'

Expand Down
@@ -1,9 +1,4 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

# CLI INTERFACE THAT EVALUATES THE SIMILARITY BETWEEN STACK TRACES IN A GIVEN SIGNATURE.

import download_data
import crash_similarity
import sys
Expand Down
@@ -1,7 +1,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import download_data
import crash_similarity
import argparse
Expand Down
@@ -1,9 +1,4 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

# CLI INTERFACE THAT TAKES STACK TRACE AS INPUT AND RETURNS SIMILAR STACK TRACES

import download_data
import crash_similarity
import argparse
Expand Down
4 changes: 0 additions & 4 deletions utils.py → crashsimilarity/utils.py
@@ -1,7 +1,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

from datetime import datetime, timedelta

from smart_open import smart_open
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
@@ -1,3 +1,4 @@
flake8==3.3.0
coverage==4.1
pytest==3.0.7
requests_mock==1.3.0
3 changes: 2 additions & 1 deletion tests/test_bugzilla.py
@@ -1,5 +1,6 @@
import unittest
import bugzilla

from crashsimilarity import bugzilla


class BugzillaTest(unittest.TestCase):
Expand Down
11 changes: 4 additions & 7 deletions tests/test_crash_similarity.py
@@ -1,13 +1,10 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import unittest
import json
import multiprocessing
import unittest

import requests_mock
import crash_similarity
import utils

from crashsimilarity import crash_similarity, utils

funcs = [('js::jit::MakeMRegExpHoistable ', 'js::jit::makemregexphoistable '), (' AppKit@0x7be82f ', ' appkit@0x'), (' __RtlUserThreadStart ', ' __rtluserthreadstart '), (' xul.dll@0x1ade7cf ', ' xul.dll@0x'), ('XUL@0x7bd20f', 'xul@0x'), ('libxul.so@0xe477b4 ', 'libxul.so@0x')]

Expand Down
6 changes: 1 addition & 5 deletions tests/test_signature_coherence.py
@@ -1,8 +1,4 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import crash_similarity
from crashsimilarity import crash_similarity


if __name__ == '__main__':
Expand Down
6 changes: 1 addition & 5 deletions tests/test_signatures_similarity.py
@@ -1,8 +1,4 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import crash_similarity
from crashsimilarity import crash_similarity


if __name__ == '__main__':
Expand Down
6 changes: 1 addition & 5 deletions tests/test_top_similar_traces.py
@@ -1,8 +1,4 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

import crash_similarity
from crashsimilarity import crash_similarity


if __name__ == '__main__':
Expand Down
3 changes: 2 additions & 1 deletion tests/test_utils.py
@@ -1,7 +1,8 @@
import utils
import unittest
from datetime import datetime

from crashsimilarity import utils


class UtilsTest(unittest.TestCase):

Expand Down

0 comments on commit 86786e1

Please sign in to comment.