diff --git a/axelrod/tests/unit/test_tournament.py b/axelrod/tests/unit/test_tournament.py index f8cca4bb4..7f0e20d65 100644 --- a/axelrod/tests/unit/test_tournament.py +++ b/axelrod/tests/unit/test_tournament.py @@ -732,13 +732,19 @@ def test_write_to_csv_without_results(self): self.assertTrue(df.equals(expected_df)) @given(seed=integers(min_value=1, max_value=4294967295)) + @example(seed=2) @settings(max_examples=5, deadline=None) def test_seeding_equality(self, seed): """Tests that a tournament with a given seed will return the same results each time. This specifically checks when running using multiple cores so as to confirm that https://github.com/Axelrod-Python/Axelrod/issues/1277 - is fixed.""" + is fixed. + + Note that the final asserts test only specific properties of the results + sets and not the entire result sets as some floating point errors can + emerge. + """ rng = axl.RandomGenerator(seed=seed) players = [axl.Random(rng.random()) for _ in range(8)] tournament1 = axl.Tournament( @@ -758,9 +764,12 @@ def test_seeding_equality(self, seed): seed=seed ) for _ in range(4): - results1 = tournament1.play(processes=2) - results2 = tournament2.play(processes=2) - self.assertEqual(results1.ranked_names, results2.ranked_names) + results1 = tournament1.play(processes=2, progress_bar=False) + results2 = tournament2.play(processes=2, progress_bar=False) + self.assertEqual(results1.wins, results2.wins) + self.assertEqual(results1.match_lengths, results2.match_lengths) + self.assertEqual(results1.scores, results2.scores) + self.assertEqual(results1.cooperation, results2.cooperation) def test_seeding_inequality(self): players = [axl.Random(0.4), axl.Random(0.6)] diff --git a/docs/tutorials/contributing/guidelines.rst b/docs/tutorials/contributing/guidelines.rst index 42fc0923d..6dec5f8c2 100644 --- a/docs/tutorials/contributing/guidelines.rst +++ b/docs/tutorials/contributing/guidelines.rst @@ -20,7 +20,7 @@ The project follows the following guidelines: from `Chris Beams `_ 5. Testing: the project uses the `unittest `_ library and has a nice - testing suite that makes some things very easy to write tests for. Please try + testing suite that makes some things easy to write tests for. Please try to increase the test coverage on pull requests. 6. Merging pull-requests: We require two of the (currently three) core-team maintainers to merge. Opening a PR for early diff --git a/docs/tutorials/contributing/index.rst b/docs/tutorials/contributing/index.rst index 9460afdbf..6a3555ad7 100644 --- a/docs/tutorials/contributing/index.rst +++ b/docs/tutorials/contributing/index.rst @@ -10,6 +10,7 @@ Contents: :maxdepth: 2 guidelines.rst + setting_up_the_environment.rst strategy/index.rst library/index.rst running_tests.rst diff --git a/docs/tutorials/contributing/running_tests.rst b/docs/tutorials/contributing/running_tests.rst index 3afcde7f6..f3ca6d961 100644 --- a/docs/tutorials/contributing/running_tests.rst +++ b/docs/tutorials/contributing/running_tests.rst @@ -4,10 +4,6 @@ Running tests Basic test runners ------------------ -Before running tests, you should have hypothesis 3.2 installed:: - - $ pip install hypothesis==3.2 - The project has an extensive test suite which is run each time a new contribution is made to the repository. If you want to check that all the tests pass before you submit a pull request you can run the tests yourself:: @@ -73,12 +69,3 @@ You can also run the type checker on a given file. For example, to run the type checker on the Grudger strategy:: $ mypy --ignore-missing-imports --follow-imports skip axelrod/strategies/grudger.py - - -Continuous integration -====================== - -This project is being taken care of by `travis-ci -`_, so all tests will be run automatically when opening -a pull request. You can see the latest build status `here -`_. diff --git a/docs/tutorials/contributing/setting_up_the_environment.rst b/docs/tutorials/contributing/setting_up_the_environment.rst new file mode 100644 index 000000000..2d6be2f86 --- /dev/null +++ b/docs/tutorials/contributing/setting_up_the_environment.rst @@ -0,0 +1,38 @@ +Setting up the environment +========================== + +Installing all dependencies +--------------------------- + +All dependencies can be installed by running:: + + $ pip install -r requirements.txt + +It is recommended to do this using a virtual environment tool of your choice. + +For example, when using the virtual environment library :code:`venv`:: + + $ python -m venv axelrod_development + $ source axelrod_development/bin/activate + $ pip install -r requirements.txt + +The git workflow +---------------- + +There are two important branches in this repository: + +- :code:`dev`: The most up to date branch with no failing tests. + This is the default branch on github. +- :code:`release`: The latest release. + +When working on a new contribution branch from the latest :code:`dev` branch and +open a Pull Request on github from your branch to the :code:`dev` branch. + +The procedure for a new release (this is carried out by one of core maintainers): + +1. Create a Pull Request from :code:`dev` to :code:`release` which should + include an update to :code:`axelrod/version.py` and :code:`CHANGES.md` +2. Create a git tag. +3. Push to github. +4. Create a release on github. +5. Push to PyPi: :code:`python setup.py sdist bdist_wheel upload`