-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup namespace handling in tests (#100)
* Cleanup namespace handling in tests When we did a lot of recent Python2-isms cleanup recently it broke some tests when run in an environment where a previous version of paste, or one of the consumers of its namespace package, were already installed. This was probably done to quiet warnings. However, it hides issues with complex environments. In addition to fixing the problem, this change adds a tox test environment that should cause a failure if we introduce the error again. Fixes #99 * remove skipsdist to see if that ensures namespace * update LICENSE per #101
- Loading branch information
Showing
6 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docs/license.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
"""Tests for Paste""" | ||
import sys | ||
import os | ||
|
||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) | ||
|
||
import pkg_resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,28 @@ | ||
[tox] | ||
envlist = py{36, 37, 38, 39, 310, 311, 312, py} | ||
envlist = py{36, 37, 38, 39, 310, 311, 312, py},py311-namespace | ||
|
||
[base] | ||
deps = | ||
pytest | ||
setuptools | ||
|
||
[testenv] | ||
# For performance, but also for using "source" with coveragepy (https://github.com/nedbat/coveragepy/issues/268). | ||
usedevelop = True | ||
deps = | ||
pytest | ||
{[base]deps} | ||
coverage: coverage | ||
coverage: pytest-cov | ||
setenv = | ||
coverage: PYTEST_ADDOPTS=--cov --cov-report=term-missing | ||
commands = | ||
pytest {posargs} | ||
python -m pytest {posargs} | ||
|
||
# Test an environment where paste, pastedeploy and pastescript are already | ||
# installed. | ||
[testenv:py311-namespace] | ||
deps = | ||
{[base]deps} | ||
Paste==3.9.0 | ||
PasteDeploy | ||
pastescript |
13dc956
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import pygame
import random
pygame.init()
Variabel layar
screen_width = 800
screen_height = 600
cell_size = 20
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Snake Game")
Warna yang digunakan
black = (0, 0, 0)
white = (255, 255, 255)
green = (0, 255, 0)
Fungsi tampilan teks
def print_text(message, color, x, y, font_size):
font = pygame.font.SysFont(None, font_size)
text = font.render(message, True, color)
screen.blit(text, (x, y))
Fungsi utama game
def game():
snake = [[screen_width // 2, screen_height // 2]]
snake_dir = [0, 0]
food_pos = [random.randint(0, screen_width // cell_size - 1) * cell_size,
random.randint(0, screen_height // cell_size - 1) * cell_size]
Memulai game
game()