mudpy.git
6 years agoUse "group" instead of "category"
Jeremy Stanley [Thu, 16 Nov 2017 02:36:34 +0000 (02:36 +0000)]
Use "group" instead of "category"

Update all uses of category/categories to group/groups. Also add
selftests for the "show groups" and "show group <group>" commands.

6 years agoDrop old-style Element support
Jeremy Stanley [Sun, 12 Nov 2017 01:48:28 +0000 (01:48 +0000)]
Drop old-style Element support

The transition to the new data model is complete, and support for
the old model is now removed.

6 years agoConvert sample data to new style
Jeremy Stanley [Sun, 12 Nov 2017 01:35:15 +0000 (01:35 +0000)]
Convert sample data to new style

Use the new data model for the sample room and prop definitions.

6 years agoUse new style for menu definitions
Jeremy Stanley [Sun, 12 Nov 2017 00:52:06 +0000 (00:52 +0000)]
Use new style for menu definitions

Convert menus to the new data model.

6 years agoConvert command Elements to new-style
Jeremy Stanley [Sun, 12 Nov 2017 00:27:25 +0000 (00:27 +0000)]
Convert command Elements to new-style

Apply the new data model to command definitions.

6 years agoSwitch archetypes to new-style Elements
Jeremy Stanley [Fri, 10 Nov 2017 02:09:44 +0000 (02:09 +0000)]
Switch archetypes to new-style Elements

Apply the new data model to archetypes.

6 years agoSwitch internal counters to new-style Element
Jeremy Stanley [Fri, 10 Nov 2017 01:55:04 +0000 (01:55 +0000)]
Switch internal counters to new-style Element

Convert the internal:counters Element to internal.counters following
the new data model.

6 years agoSwitch actors to new-style elements
Jeremy Stanley [Thu, 9 Nov 2017 10:00:11 +0000 (10:00 +0000)]
Switch actors to new-style elements

Actor elements created for avatars now follow the new data model.

6 years agoHandle connection reset in selftest
Jeremy Stanley [Thu, 9 Nov 2017 09:58:38 +0000 (09:58 +0000)]
Handle connection reset in selftest

Within the selftest framework, catch ConnectionResetError exceptions
and provide a clearer error.

6 years agoMake new-style facet deletion more robust
Jeremy Stanley [Thu, 9 Nov 2017 09:54:38 +0000 (09:54 +0000)]
Make new-style facet deletion more robust

When destroying a new-style Element, reuse the delete_facet method
instead of deleting keys from the origin. Within the delete_facet
method, make sure to delete the corresponding key from the facethash
too.

6 years agoCatch Exception when necessary
Jeremy Stanley [Thu, 9 Nov 2017 05:29:24 +0000 (05:29 +0000)]
Catch Exception when necessary

In situations where any exception needs to be matched in an except
clause, specify the Exception base class so as to be explicit that
it's an intentional choice and not an accidental omission.

6 years agoClearer selftest errors on disconnection
Jeremy Stanley [Tue, 17 Oct 2017 07:55:03 +0000 (07:55 +0000)]
Clearer selftest errors on disconnection

Catch EOFError in the selftest framework and emit a message
indicating what happened.

6 years agoUse new-style elements for accounts
Jeremy Stanley [Wed, 4 Oct 2017 08:27:25 +0000 (08:27 +0000)]
Use new-style elements for accounts

Switch account elements to the new data model, and fix some
old-style assumptions in Element creation and destruction. Also use
(and coerce to) boolean values for the administrator facet, and be
more clear in logs when accounts authenticating are admins or not.

6 years agoFix unhandled exception in show file command
Jeremy Stanley [Wed, 27 Sep 2017 16:52:45 +0000 (16:52 +0000)]
Fix unhandled exception in show file command

When generating the list of nodes from a file for the "show file"
command output, treat the data attribute as a list rather than a
dict. Previously, use of this command would crash the interpreter on
an unhandled exception attempting to invoke a nonexistent (since the
data model conversion) .keys() method.

While we're here, correct the output preamble to refer to the file
contents as "nodes" instead of "elements since it also includes
non-element nodes. Also correct the error message when a nonexistent
file is requested to say "file" instead of "category" (this was
probably cut-n-pasted from "show categories" and missed getting
updated).

For future safety, add a selftest to exercise the "show files"
command.

6 years agoDisplay flags in show files output
Jeremy Stanley [Wed, 27 Sep 2017 16:48:47 +0000 (16:48 +0000)]
Display flags in show files output

When the "show files" command is issued, any optional file flags
such as "private" are displayed after the filename.

Also add a selftest to exercise this command.

6 years agoClean up a stray comment in find_file
Jeremy Stanley [Sat, 16 Sep 2017 17:48:19 +0000 (17:48 +0000)]
Clean up a stray comment in find_file

Remove a long-lived cruft comment line from the data.find_file()
function, obsoleted back when filename normalization was broken out
of the return line into some more explicit earlier calls (prior to
the initial archive import into Git).

6 years agoAdd descriptions to sample datafiles
Jeremy Stanley [Sat, 16 Sep 2017 17:43:08 +0000 (17:43 +0000)]
Add descriptions to sample datafiles

For improved clarity, add some basic descriptions to the provided
sample datafiles in "_desc" metadata keys.

6 years agoMove sample datafile copyrights into metadata
Jeremy Stanley [Sat, 16 Sep 2017 17:41:02 +0000 (17:41 +0000)]
Move sample datafile copyrights into metadata

Instead of using YAML comments in the provided sample datafiles,
standardize on a "_copy" metadata key for greater extensibility.

6 years agoData nodes starting with "_" are metadata
Jeremy Stanley [Sat, 16 Sep 2017 17:35:48 +0000 (17:35 +0000)]
Data nodes starting with "_" are metadata

Avoid loading data nodes with a "_" prefix as Universe content.
These are only used as file-local metadata.

6 years agoInterpret a "." prefix as the startdir
Jeremy Stanley [Sat, 16 Sep 2017 17:29:38 +0000 (17:29 +0000)]
Interpret a "." prefix as the startdir

Since daemonization explicitly changes the working directory to "/",
specifying a mudpy.filing.prefix of "." should be taken to refer to
the original starting directory recorded in Universe.startdir rather
than the current directory for the process.

6 years agoOverhaul data management to get rid of __control__
Jeremy Stanley [Sun, 27 Aug 2017 17:07:45 +0000 (17:07 +0000)]
Overhaul data management to get rid of __control__

Remap __control__ subkeys in data as follows:

    default_files -> .mudpy.filing.categories
    include_dirs -> _load
    include_files -> _load
    read_only -> _lock

Additionally, obsolete the __control__.private_files key by
switching from raw file/directory names to associative arrays in the
category defaults so that flags such as "private" can be added to
them, and make the category filenames automatically determined so
that they can be omitted unless specific overrides are required.

For the sake of future-proofing, rename the DataFile class to Data
and its "filename" attribute to "source" so that we avoid confusing
renames later when these might instead refer to some other storage
medium such as a table in a database. Similarly rename the Element
class attribute "filename" to "origin" attribute both to make it
more generic and to avoid confusion with "source" (an Element's
origin is a complete Data object, while a Data's source is just a
rooted-anchored file path currently).

Add a Universe.add_category convenience method to handle properly
guessing the corresponding fallback path and copying any declared
flags.

6 years agoError if set command is used on read-only element
Jeremy Stanley [Mon, 31 Jul 2017 15:14:08 +0000 (15:14 +0000)]
Error if set command is used on read-only element

It is possible for an admin to accidentally attempt to set a facet
on an element from a read-only file. If this happens, trap the
PermissionError exception and return a clear error message to the
user instead of crashing the service. Also add a regression test to
make sure this continues to work as intended, since preventing
alteration of read-only elements is a critical security measure we
need to make certain we preserve going forward.

6 years agoRefuse to alter read-only elements at runtime
Jeremy Stanley [Mon, 31 Jul 2017 15:00:33 +0000 (15:00 +0000)]
Refuse to alter read-only elements at runtime

In the Element.set() method, check whether the element being altered
is from a read-only file. That should only ever happen when
(re)loading of files is underway, either at start time or because
the reload command/SIGHUP has been issued. If an attempt is made to
change a read-only element at any other time, raise a
PermissionError exception instead of setting the new value in memory
(altered values were never written to the backing file, but prior to
this it was possible to modify the in-memory copies).

6 years agoTrack whether loading is underway
Jeremy Stanley [Mon, 31 Jul 2017 14:56:57 +0000 (14:56 +0000)]
Track whether loading is underway

In preparation for safeguards preventing alteration of elements from
read-only backing files, we need a way to identify that loading
updated files is in progress; that's the only time elements from
read-only files should ever change.

6 years agoTest the set command
Jeremy Stanley [Mon, 31 Jul 2017 14:54:34 +0000 (14:54 +0000)]
Test the set command

Add a test to make sure the set command works, and use it to alter
the facet we're subsequently checking in the writeable element for
the show element test to make sure it actually worked.

6 years agoUse writeable element in show element test
Jeremy Stanley [Mon, 31 Jul 2017 14:49:09 +0000 (14:49 +0000)]
Use writeable element in show element test

In preparation for being able to test the set command, switch the
legacy element being shown to one which is not in a read-only file
so that we'll be able to test altering it in a future change.

6 years agoUpdate copyright dates for files changed this year
Jeremy Stanley [Sun, 30 Jul 2017 15:52:46 +0000 (15:52 +0000)]
Update copyright dates for files changed this year

Bump the copyright date to the present for files which received
significant modification since the beginning of the year.

6 years agoRename internal:storage to .mudpy.filing
Jeremy Stanley [Sun, 30 Jul 2017 02:40:25 +0000 (02:40 +0000)]
Rename internal:storage to .mudpy.filing

Convert the old style internal:storage element to a new style
.mudpy.filing element and adjust the find_file() function
accordingly.

6 years agoStop unnecessarily stripping quote marks
Jeremy Stanley [Sat, 29 Jul 2017 18:42:30 +0000 (18:42 +0000)]
Stop unnecessarily stripping quote marks

Since the switch to YAML, quotations around strings are
automatically interpreted an so not included in the parsed result.
Remove legacy code which stripped leading and trailing quotes from
string values as this is no longer needed.

6 years agoExplicitly configure the root_path in examples
Jeremy Stanley [Sat, 29 Jul 2017 18:34:55 +0000 (18:34 +0000)]
Explicitly configure the root_path in examples

In the example and test configurations, set the root_path value to
"." signifying the current/starting directory. This exercises the
option so we can make sure it doesn't break anything.

6 years agoLog missing file inclusions as more severe
Jeremy Stanley [Sat, 29 Jul 2017 18:31:40 +0000 (18:31 +0000)]
Log missing file inclusions as more severe

When another file is included with an inc macro in text, being
unable to load that file could indicate a fairly serious
configuration error. Increase the severity of the log message for
this so that it will be more easily noticed and caught in testing.

6 years agoFix file pathing in daemon mode
Jeremy Stanley [Sat, 29 Jul 2017 18:24:06 +0000 (18:24 +0000)]
Fix file pathing in daemon mode

If run as a daemon, the working directory is reset to "/" for
safety. Make sure that relative file searching takes this into
account and prefixes with the original (pre-chdir) start directory
rather than the current working directory.

6 years agoRename internal:time to .mudpy.timing
Jeremy Stanley [Sat, 29 Jul 2017 16:18:16 +0000 (16:18 +0000)]
Rename internal:time to .mudpy.timing

Convert the old style internal:time element to a new style
.mudpy.timing element and adjust the User.check_idle() method and
on_pulse() function accordingly.

6 years agoSwitch example listening port from 6669 to 4000
Jeremy Stanley [Sat, 29 Jul 2017 15:27:22 +0000 (15:27 +0000)]
Switch example listening port from 6669 to 4000

As a nod to the legacy of DikuMUD, use 4000/tcp as the example
listening socket instead of 6669/tcp.

6 years agoFix facets method to give new-style relative names
Jeremy Stanley [Sat, 29 Jul 2017 15:05:26 +0000 (15:05 +0000)]
Fix facets method to give new-style relative names

For new-style elements correct the facets method to return short
(relative) key names, maintaining parity with old-style elements.
Add a new-style element to the "show element" selftest so that we
can make sure it won't regress.

6 years agoUse importlib in place of imp
Jeremy Stanley [Sat, 29 Jul 2017 15:01:08 +0000 (15:01 +0000)]
Use importlib in place of imp

As of Python 3.4, the newer importlib module supports the reload()
function we need. Switch from the deprecated imp module, except
before 3.4 where we will simply pretend imp is importlib for
readability.

6 years agoReduce the log message priority for reload calls
Jeremy Stanley [Sat, 29 Jul 2017 14:53:36 +0000 (14:53 +0000)]
Reduce the log message priority for reload calls

It's important to log when the "reload" command is issued, but it's
not an error condition. Log the event at priority 6 rather than 8.

6 years agoExercise the reload command in tests
Jeremy Stanley [Sat, 29 Jul 2017 14:51:37 +0000 (14:51 +0000)]
Exercise the reload command in tests

To make sure it doesn't get broken in a coming change, call the
admin command `reload` in the selftest.

6 years agoSwitch quoting styles to reduce escaped quotes
Jeremy Stanley [Sat, 29 Jul 2017 03:56:25 +0000 (03:56 +0000)]
Switch quoting styles to reduce escaped quotes

In an effort to address leaning toothpick syndrome, adjust quoting
styles where possible to avoid escaping quote marks without
increasing ambiguity.

6 years agoUse raw strings when escape sequences are needed
Jeremy Stanley [Fri, 28 Jul 2017 20:03:58 +0000 (20:03 +0000)]
Use raw strings when escape sequences are needed

Python 3.6 has added a DeprecationWarning for any regular strings
containing non-doubled backslash escapes. Use raw strings for these
instead so we'll be ready when the old syntax is eventually
disallowed.

6 years agoCorrect name of the custom loglevel test
Jeremy Stanley [Sun, 2 Jul 2017 15:13:59 +0000 (15:13 +0000)]
Correct name of the custom loglevel test

Make the name of the custom loglevel test distinct from the show log
test preceeding it.

6 years agoHandle ValueError when setting incorrect type
Jeremy Stanley [Sun, 2 Jul 2017 15:11:17 +0000 (15:11 +0000)]
Handle ValueError when setting incorrect type

Trap for ValueError exceptions when attempting to pass a value to
the set command with an incorrect data type for the facet being set,
returning a clear failure message to the calling user.

6 years agoCoerce loglevel facet to int when updating
Jeremy Stanley [Thu, 15 Jun 2017 15:26:10 +0000 (15:26 +0000)]
Coerce loglevel facet to int when updating

Calling the set command always results in updating values to type
str, which can result in failures when those values are later
re-read. Explicitly coerce the loglevel value to int whenever it is
updated to avoid a subsequent exception when calling the show log
command.

This points out a need for maintaining a schema so that values can
be coerced to the appropriate type when needed, but for now the
conditional adjustment can serve as a placeholder for a more
thorough design.

6 years agoClear vestigial ord() calls in telopt negotiation
Jeremy Stanley [Sun, 14 May 2017 18:23:24 +0000 (18:23 +0000)]
Clear vestigial ord() calls in telopt negotiation

Clean up missed ordinal recasting on telnet options during
negotiation. They're no longer necessary, and crash the service if
triggered.

6 years agoStop using vary_rounds with passlib
Jeremy Stanley [Sun, 14 May 2017 17:42:40 +0000 (17:42 +0000)]
Stop using vary_rounds with passlib

The passlib library has deprecated the vary_rounds KDF parameter
since it's basically pointless as long as a strong salt is employed.
Proactively remove the reference as it will no longer be accepted by
passlib 2.0.

6 years agoGuard against KeyError on universe.contents index
Jeremy Stanley [Sun, 14 May 2017 16:42:55 +0000 (16:42 +0000)]
Guard against KeyError on universe.contents index

When accessing base level configuration elements from the main
engine, check that they're actually in universe.contents before
trying to retrieve their facets. Also use sane default fallbacks if
they're undefined.

6 years agoEnable initial admin account in example config
Jeremy Stanley [Sun, 14 May 2017 14:00:11 +0000 (14:00 +0000)]
Enable initial admin account in example config

The example etc/mudpy.yaml, intended for demonstration purposes,
only binds a listening socket on the loopback interface so shouldn't
be exposed remotely. As a result, turn on the configuration option
to enable elevating the account named "admin" to administrative
privileges automatically upon creation. This allows to run tests of
admin-specific commands with the example configuration.

Also rename the "testadmin" account used by the selftest to match
the name of the default for consistency, and rename test_config.yaml
to test_daemon.yaml reflecting its primary purpose (and also to open
the way for additional test configs as well).

6 years agoIgnore unpacked *.egg directories
Jeremy Stanley [Thu, 4 May 2017 19:34:08 +0000 (19:34 +0000)]
Ignore unpacked *.egg directories

When performing in-tree sdist installs, stray *.egg directories may
be left behind. Don't track them.

7 years agoModernize coder documentation
Jeremy Stanley [Mon, 17 Apr 2017 16:46:27 +0000 (16:46 +0000)]
Modernize coder documentation

Update the coder docs to remove obsolete references to the old
git2gch script, include new information on testing expectations and
outline a recommended tox-based developer environment and workflow.

7 years agoAdd a generic tox env for sdist generation et al
Jeremy Stanley [Mon, 17 Apr 2017 16:03:57 +0000 (16:03 +0000)]
Add a generic tox env for sdist generation et al

Add a testenv:venv environment to the tox.ini as a convenience for
things like sdist/wheel building or generating documentation. Also
add the autogenerated files from running setup.py sdist and
bdist_wheel commands to the .gitignore file.

7 years agoAdd a suitable test config for the daemon
Jeremy Stanley [Tue, 28 Mar 2017 02:21:39 +0000 (02:21 +0000)]
Add a suitable test config for the daemon

In service of more repeatable testing and improved feature coverage,
include a test fixture for a version of the normal sample
configuration with some additional non-default features enabled and
some settings tuned to values which make testing easier/faster (not
recommended for production use):

* allow "testuser" to automatically be an admin when created

* enable data backup copies but keep only 3 when rotating

* turn on file-backed logging

* background the daemon process once initialized

* write a pidfile

* inject status updates into logs every 25 ticks

* save and rotate datafiles every 5 ticks

7 years agoPackage the self-test script as an entrypoint
Jeremy Stanley [Mon, 20 Feb 2017 21:42:08 +0000 (21:42 +0000)]
Package the self-test script as an entrypoint

Move the self-test script into the Python package and define an
entrypoint for it in setup.cfg so a `mudpy_selftest` executable will
be installed.

7 years agoCorrect filesystem permissions on daemon module
Jeremy Stanley [Mon, 20 Feb 2017 06:32:53 +0000 (06:32 +0000)]
Correct filesystem permissions on daemon module

When the executable script was moved to become an in-package module,
its permissions were incorrectly left executable. Correct them to
match the other modules in the package.

7 years agoMake the self-test script importable
Jeremy Stanley [Mon, 2 Jan 2017 06:06:41 +0000 (06:06 +0000)]
Make the self-test script importable

In preparation for moving the self-test script to a more standard
entrypoint, make it safely importable and give it a separate
conditional main() execution.

7 years agoAdd missing copyright/license notices
Jeremy Stanley [Fri, 16 Dec 2016 09:55:47 +0000 (09:55 +0000)]
Add missing copyright/license notices

For clarity, add copyright and license notice headers at the tops of
files which were missing them (general packaging configuration and
metadata for the most part, but doesn't hurt to be thorough for the
sake of future provenance inquiries).

7 years agoSupport running flake8 under tox
Jeremy Stanley [Thu, 15 Dec 2016 11:25:38 +0000 (11:25 +0000)]
Support running flake8 under tox

Add the necessary configuration to be able to run `tox` for
performing style checks easily with flake8.

7 years agoPackage the daemon executable as an entrypoint
Jeremy Stanley [Thu, 15 Dec 2016 06:17:09 +0000 (06:17 +0000)]
Package the daemon executable as an entrypoint

Move the daemon executable into the Python package and define an
entrypoint for it in setup.cfg so a similar `mudpy` executable will
still be installed. Drop the unnecessary import path override now
while at it.

7 years agoMake the executable importable
Jeremy Stanley [Wed, 14 Dec 2016 19:45:30 +0000 (19:45 +0000)]
Make the executable importable

In preparation for moving the executable to an more standard
entrypoint, make it safely importable and give it a separate
conditional main() execution.

7 years agoCreate a Python package
Jeremy Stanley [Wed, 14 Dec 2016 01:05:09 +0000 (01:05 +0000)]
Create a Python package

Add setup.cfg and setup.py files sufficient to create a "mudpy"
Python package suitable for `pip install` and uploading to PyPI.

7 years agoAppease style checks
Jeremy Stanley [Thu, 24 Nov 2016 06:28:14 +0000 (06:28 +0000)]
Appease style checks

Once more the PEP8 gods stir to anger. Sate their fury with a
generous offering of whitespace, such that they might return to
their baleful slumber.

7 years agoClean up trailing whitespace in documentation
Jeremy Stanley [Wed, 23 Nov 2016 14:03:37 +0000 (14:03 +0000)]
Clean up trailing whitespace in documentation

Remove some unsightly trailing whitespace in the readme and coder
reference.

7 years agoMove documentation files for packaging preparation
Jeremy Stanley [Thu, 20 Oct 2016 17:11:30 +0000 (17:11 +0000)]
Move documentation files for packaging preparation

Move doc/coder.txt into doc/source/ where Sphinx will expect it,
doc/LICENSE to the top-level directory renamed to LICENSE.rst for
clarity on its format, and similarly rename README to README.rst as
well.

7 years agoMove lib/mudpy to mudpy for packaging preparation
Jeremy Stanley [Wed, 5 Oct 2016 10:02:35 +0000 (10:02 +0000)]
Move lib/mudpy to mudpy for packaging preparation

Move the lib/mudpy tree to just mudpy where it will ultimately
reside once integrated into a Python package. Temporarily adjust the
module search path addition in the executable until packaging work
is complete (at which point it can safely be dropped).

7 years agoRename internal:process to .mudpy.process
Jeremy Stanley [Sun, 18 Sep 2016 06:25:31 +0000 (06:25 +0000)]
Rename internal:process to .mudpy.process

Convert the old style internal:process element to a new style
.mudpy.process element and adjust the daemonize(), create_pidfile()
and remove_pidfile() functions accordingly.

7 years agoRename internal:network to .mudpy.network
Jeremy Stanley [Thu, 15 Sep 2016 06:44:48 +0000 (06:44 +0000)]
Rename internal:network to .mudpy.network

Convert the old style internal:network element to a new style
.mudpy.network element and adjust the initialize_server_socket()
function accordingly.

7 years agoRename internal:directions to .mudpy.movement.*
Jeremy Stanley [Wed, 24 Aug 2016 01:17:08 +0000 (01:17 +0000)]
Rename internal:directions to .mudpy.movement.*

Convert the old style internal:directions element to a series of new
style .mudpy.movement.* elements and adjust the move_direction()
function accordingly. Also extend the Universe class to provide a
set-based index of direction names found in the data.

7 years agoRename internal:logging: to .mudpy.log
Jeremy Stanley [Sun, 24 Jul 2016 01:14:10 +0000 (01:14 +0000)]
Rename internal:logging: to .mudpy.log

Convert the old style internal:logging element to a new style
.mudpy.log element and adjust the log() function accordingly.

7 years agoUpdate README for recent development
Jeremy Stanley [Sun, 24 Jul 2016 00:45:36 +0000 (00:45 +0000)]
Update README for recent development

Edits to the README file reflect the switch to Py3K, YAML and
addition of non-stdlib dependencies.

7 years agoRename internal:limits element to .mudpy.limit
Jeremy Stanley [Sun, 17 Jul 2016 02:45:00 +0000 (02:45 +0000)]
Rename internal:limits element to .mudpy.limit

Convert the old style internal:limits element to a new style
.mudpy.limit element and rename the default_admins,
default_backup_count and max_avatars facets to admins, backups and
avatars respectively.

7 years agoStrip extra separators in show element command
Jeremy Stanley [Tue, 28 Jun 2016 07:46:08 +0000 (07:46 +0000)]
Strip extra separators in show element command

Eat leading and trailing "." separators in the show element command,
so that it will consistently search the element set for the
corresponding simplified element names.

7 years agoFix 8-bit Telnet with Py3K
Jeremy Stanley [Tue, 28 Jun 2016 06:50:50 +0000 (06:50 +0000)]
Fix 8-bit Telnet with Py3K

Replace the lambda filter for non-ASCII characters with a list
comprehension, correcting and simplifying the range comparison and
recombination of the filtered string.

7 years agoRename internal:language: to .mudpy.linguistic
Jeremy Stanley [Mon, 9 May 2016 05:09:14 +0000 (05:09 +0000)]
Rename internal:language: to .mudpy.linguistic

Convert the old style internal:language element to a new style
.mudpy.linguistic element and adjust the command_say() function
accordingly.

7 years agoImplement new style element support
Jeremy Stanley [Thu, 21 Apr 2016 14:35:13 +0000 (14:35 +0000)]
Implement new style element support

Add support for new style elements implemented as a flat associative
array of facets prefixed with their element names, and switching to
"." as a prefix separator. This is initially backward compatible
using a toggle and some sniffing of key names to distinguish old and
new style elements. Once the transition from old to new style has
been completed, the compatibility code can be cleaned up.

8 years agoTest the show element command
Jeremy Stanley [Sat, 16 Apr 2016 03:10:32 +0000 (03:10 +0000)]
Test the show element command

Add a functional test for the show element command, to prevent
future regressions in it.

8 years agoSimplify multiline matching in functional tests
Jeremy Stanley [Sat, 16 Apr 2016 02:06:12 +0000 (02:06 +0000)]
Simplify multiline matching in functional tests

To ease matching across more complex outputs in functional test
conversations, use compiled expressions with the DOTALL flag so that
the "." wildcard will also match newline characters in the stream.

8 years agoFix show element command for Py3K
Jeremy Stanley [Sat, 16 Apr 2016 01:02:48 +0000 (01:02 +0000)]
Fix show element command for Py3K

Under Python 3, the dict.keys() method returns a generator rather
than a list and so cannot support the list.sort() method. Instead
use the sorted() function for this purpose in the show element
command. Also switch from concatenation to formatting to embed
facets in the output since they may contain nontext values.

8 years agoMake escape_macros no-op on nontext values
Jeremy Stanley [Thu, 17 Mar 2016 10:03:45 +0000 (10:03 +0000)]
Make escape_macros no-op on nontext values

Update the escape_macros() function to deal with YAML style
Element.get() that may return datatypes other than str. This allows
for indiscriminately passing facets through the function without
recasting them.

8 years agoCheck that functional tests log no errors
Jeremy Stanley [Mon, 7 Mar 2016 13:16:38 +0000 (13:16 +0000)]
Check that functional tests log no errors

After all other functional tests, check the output of show log 7 to
make sure that no earlier tests caused errors at or above that
loglevel.

8 years agoTest that the show log command works
Jeremy Stanley [Mon, 7 Mar 2016 12:26:43 +0000 (12:26 +0000)]
Test that the show log command works

Exercise the show log command in functional testing, and confirm
that it returns at least some log data.

8 years agoFix show log command for Py3K
Jeremy Stanley [Mon, 7 Mar 2016 11:43:13 +0000 (11:43 +0000)]
Fix show log command for Py3K

The behavior of lambda filters has changed in Python 3 such that you
can no longer treat them directly as lists. Trivially reimplement
them as list comprehensions. Also correct a missing minimum loglevel
fallback default.

8 years agoFix recursive BrokenPipeException on disconnect
Jeremy Stanley [Tue, 23 Feb 2016 22:32:27 +0000 (22:32 +0000)]
Fix recursive BrokenPipeException on disconnect

When an admin user has a broken pipe, attempting to log
BrokenPipeException errors to their socket raises another until the
max recursion depth is hit. Set the current user's state to
disconnecting before logging the error instead of after, so as to
avoid this loop.

8 years agoSwitch basic data loader unit from element to node
Jeremy Stanley [Sun, 21 Feb 2016 21:45:07 +0000 (21:45 +0000)]
Switch basic data loader unit from element to node

In preparation for a migration to a new flat data model where
elements are inferred from facet names, stop referring to the
top-level keys in data files as elements and instead call them
nodes. During the transitional period, a node could be an old-style
element or a new-style element's facet.

8 years agoExplicitly invoke Python 3.x in shebang lines
Jeremy Stanley [Sun, 24 Jan 2016 19:59:45 +0000 (19:59 +0000)]
Explicitly invoke Python 3.x in shebang lines

Since the codebase relies on Py3K-only syntax in places, explicitly
invoke the python3 interpreter rather than expecting the
environment's primary interpreter to support Python 3.x code.

8 years agoTest admin account restrictions
Jeremy Stanley [Mon, 28 Dec 2015 13:13:09 +0000 (13:13 +0000)]
Test admin account restrictions

Add an admin session in the functional tests, and confirm that an
admin can see a restricted function in the help output while a
non-admin cannot see it. Further confirm that an admin command
behaves as an unknown command when a non-admin attempts to call it.

8 years agoMore thorough match on chat mode test
Jeremy Stanley [Tue, 1 Dec 2015 01:45:58 +0000 (01:45 +0000)]
More thorough match on chat mode test

Use a multi-line match on the chat mode functional test, to confirm
both the command feedback and prompt change are present.

8 years agoTest actor movement
Jeremy Stanley [Thu, 19 Nov 2015 04:21:40 +0000 (04:21 +0000)]
Test actor movement

Exercise the move command in all configured directions in the
functional tests.

8 years agoMention test session capture log file names
Jeremy Stanley [Sun, 11 Oct 2015 04:29:32 +0000 (04:29 +0000)]
Mention test session capture log file names

When writing functional test session capture logs, mention the file
names for ease of reference.

8 years agoAdd timing data to test output
Jeremy Stanley [Wed, 7 Oct 2015 20:45:05 +0000 (20:45 +0000)]
Add timing data to test output

Print individual and aggregate functional test durations.

8 years agoTest chat mode
Jeremy Stanley [Sat, 19 Sep 2015 05:09:22 +0000 (05:09 +0000)]
Test chat mode

Add a functional test for chat mode.

8 years agoAdd troubleshooting note to test failure output
Jeremy Stanley [Mon, 7 Sep 2015 03:13:31 +0000 (03:13 +0000)]
Add troubleshooting note to test failure output

When a functional test failure is encountered, recommend the
corresponding log to check for the actual output when an expected
match is not found.

8 years agoBreak outer loop of functional tests on failure
Jeremy Stanley [Sun, 6 Sep 2015 18:18:58 +0000 (18:18 +0000)]
Break outer loop of functional tests on failure

When a test failure is encountered in the inner loop of functional
tests, also break out of the outer loop so that subsequent tests are
not run.

8 years agoBe more explicit with periods in test matches
Jeremy Stanley [Tue, 1 Sep 2015 03:54:17 +0000 (03:54 +0000)]
Be more explicit with periods in test matches

Correct some missed escapes for periods (.) in functional test match
strings.

8 years agoModularize functional testing
Jeremy Stanley [Sun, 23 Aug 2015 16:20:40 +0000 (16:20 +0000)]
Modularize functional testing

Break functional test dialogue groups into separate modules and add
a description to each for ease of debugging.

8 years agoTest sentence capitalization
Jeremy Stanley [Sat, 22 Aug 2015 19:36:16 +0000 (19:36 +0000)]
Test sentence capitalization

Add a functional test to make sure uncapitalized actor speech gets
displayed with proper sentence capitalization.

8 years agoTest typo replacements
Jeremy Stanley [Sun, 9 Aug 2015 19:07:32 +0000 (19:07 +0000)]
Test typo replacements

In the functional test dialogue, add tests for typo replacements.

8 years agoTest implicit punctuation
Jeremy Stanley [Fri, 7 Aug 2015 05:51:03 +0000 (05:51 +0000)]
Test implicit punctuation

In the functional test dialogue, confirm that the configured default
punctuation is appended when implicit punctuation is expected.

8 years agoRead pending bytes before proceeding with test
Jeremy Stanley [Wed, 15 Jul 2015 20:54:53 +0000 (20:54 +0000)]
Read pending bytes before proceeding with test

After a match in found in each step of the functional test, read in
the remaining buffer before replying. This makes the captures
slightly more readable, especially if the match in early in a block
of output.

8 years agoFix punctuation match order and add tests
Jeremy Stanley [Tue, 2 Jun 2015 06:08:02 +0000 (06:08 +0000)]
Fix punctuation match order and add tests

Add explicit punctuation functional tests with a conversation
between the two test sessions, and fix a nondeterministic bug this
exposed. Punctuation is now matched in a sorted order rather than
arbitrary hash table lookup order, and the sort is reversed so that
the longest match always wins.

8 years agoTest interaction between multiple connections
Jeremy Stanley [Sun, 17 May 2015 13:24:34 +0000 (13:24 +0000)]
Test interaction between multiple connections

Extend functional testing to utilize a second connection, and test
that the second actor entering and exiting the World causes the
first actor to see the correct messages for each of these events.

8 years agoLay groundwork for more thorough functional tests
Jeremy Stanley [Sat, 9 May 2015 11:45:03 +0000 (11:45 +0000)]
Lay groundwork for more thorough functional tests

Make bin/test support an arbitrary number of connections, be more
verbose about what it's doing, and archive complete captures of each
session involved.