Skip to content

Commit

Permalink
Merge pull request #13 from sackfield/fix-foss-3
Browse files Browse the repository at this point in the history
Fix more FOSS requests
  • Loading branch information
8W9aG committed Jan 5, 2016
2 parents b6c9108 + eeda49c commit 88f65c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,30 @@ This script was made to “gameify” testing at Spotify and to continue encoura

The script uses the current working directory to find files it could possibly read (such as `.m`, `.mm` and `.java` files) and performs a `git blame` on these files in order to match tests written to the developers that wrote them.
The owner of the method name of the test is considered the developer that wrote it.
Note that since this script makes use of git, the file will need to be committed before it is counted. This will always look on the currently checked out branch.

## Dependencies

* [python 2.7.10](https://www.python.org/downloads/release/python-2710/) (for running the script)
* [git 2.6.1](https://git-scm.com/) (for finding the blame information for a given file)
* [python 2.7.9](https://www.python.org/downloads/release/python-2710/) (for running the script)
* [git 2.5.3](https://git-scm.com/) (for finding the blame information for a given file)

The script should run on any operating system containing these two dependencies.
The script should run on any operating system containing these two dependencies. The script may operate on lower python or git versions, but there is a certain of amount of buyer beware here.

## Usage

1. Run the Python script from your repository:
1. Run the Python setup.py from this repository:

```shell
> python testinggame.py
> python setup.py install
```

2. Mention that you write most unit units of your project on every meeting (no, don’t do that).
2. Run the testing game script from your repository (or subdirectory):

```shell
> testinggame
```

3. Mention that you write most unit units of your project on every meeting (no, don’t do that).


## Contribution
Expand Down
20 changes: 7 additions & 13 deletions testinggame/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _find_xctest_tests(blame_lines, names, source, xctestsuperclasses):
return names


def _find_java_tests(blame_lines, names, source):
def _find_java_tests(blame_lines, names):
"""
Finds the number of Java test cases per user. This will find tests both
with the @Test annotation and the standard test methods.
Expand All @@ -83,7 +83,6 @@ def _find_java_tests(blame_lines, names, source):
blame line.
names: The current dictionary containing the usernames as a key and the
number of tests as a value.
source: A string containing the raw source code for the file.
Returns:
A dictionary built off the names argument containing the usernames as a
key and the number of tests as a value.
Expand All @@ -104,7 +103,7 @@ def _find_java_tests(blame_lines, names, source):
return names


def _find_boost_tests(blame_lines, names, source):
def _find_boost_tests(blame_lines, names):
"""
Finds the number of Boost test cases per user.
Expand All @@ -113,7 +112,6 @@ def _find_boost_tests(blame_lines, names, source):
blame line.
names: The current dictionary containing the usernames as a key and the
number of tests as a value.
source: A string containing the raw source code for the file.
Returns:
A dictionary built off the names argument containing the usernames as a
key and the number of tests as a value.
Expand All @@ -132,7 +130,7 @@ def _find_boost_tests(blame_lines, names, source):
return names


def _find_nose_tests(blame_lines, names, source):
def _find_python_tests(blame_lines, names, source):
"""
Finds the number of python test cases per user.
Expand All @@ -141,7 +139,6 @@ def _find_nose_tests(blame_lines, names, source):
blame line.
names: The current dictionary containing the usernames as a key and the
number of tests as a value.
source: A string containing the raw source code for the file.
Returns:
A dictionary built off the names argument containing the usernames as a
key and the number of tests as a value.
Expand Down Expand Up @@ -204,16 +201,13 @@ def _find_git_status(directory, xctestsuperclasses):
xctestsuperclasses)
if fileextension in java_extensions:
names = _find_java_tests(blame_lines,
names,
source)
names)
if fileextension in cpp_extensions:
names = _find_boost_tests(blame_lines,
names,
source)
names)
if fileextension in python_extensions:
names = _find_nose_tests(blame_lines,
names,
source)
names = _find_python_tests(blame_lines,
names)
except:
'Could not open file: ' + absfile
return names
Expand Down

0 comments on commit 88f65c6

Please sign in to comment.