Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Two misc changes: Fix error message and fix copyright (with check) #252

Merged
merged 3 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/check_license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Check license

on:
pull_request:
branches:
- main

jobs:
test_license:
name: Check license headers
steps:
- uses: actions/checkout@v2

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]

- name: Check copyright header in added files
- shell: bash
- run: |
missing=0
for file in "${{ steps.changed-files.outputs.added_files }}"; do
if ! egrep -q '(Facebook, Inc(\.|,)? and its affiliates)|([0-9]{4}-present(\.|,)? Facebook)|([0-9]{4}(\.|,)? Facebook)' $file
echo "Missing copyright header in $file"
missing=$(expr $missing + 1)
done
exit $missing
1 change: 0 additions & 1 deletion .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,3 @@ jobs:
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
...
2 changes: 1 addition & 1 deletion nle/env/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def __init__(
actions = FULL_ACTIONS
self._actions = actions

self.last_observation = None
self.last_observation = ()

try:
if savedir is None:
Expand Down
16 changes: 16 additions & 0 deletions nle/tests/test_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,22 @@ def test_final_reward(self, env):
assert reward == 0.0


class TestEnvMisc:
"""Tests miscellaneous enviroment behavior."""

@pytest.fixture
def env(self):
e = gym.make("NetHackScore-v0")
try:
yield e
finally:
e.close()

def test_no_reset(self, env):
with pytest.raises(RuntimeError, match="step called without reset()"):
env.step(0)


class TestNetHackChallenge:
def test_no_seed_setting(self):
env = gym.make("NetHackChallenge-v0")
Expand Down
1 change: 1 addition & 0 deletions nle/tests/test_system.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates.
import multiprocessing as mp

import gym
Expand Down